Skip to content

Commit 0cd259b

Browse files
committed
fix unit test
1 parent fe5f098 commit 0cd259b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

dsc_lib/src/functions/target_path.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,18 @@ impl Function for TargetPath {
3838
mod tests {
3939
use crate::configure::context::Context;
4040
use crate::parser::Statement;
41-
use std::path::PathBuf;
41+
use std::{env, path::PathBuf};
4242

4343
#[test]
4444
fn init() {
4545
let mut parser = Statement::new().unwrap();
4646
let result = parser.parse_and_execute("[targetPath()]", &Context::new()).unwrap();
47-
assert_eq!(result, "");
47+
// on windows, the default is SYSTEMDRIVE env var
48+
#[cfg(target_os = "windows")]
49+
assert_eq!(result, env::var("SYSTEMDRIVE").unwrap());
50+
// on linux/macOS, the default is /
51+
#[cfg(not(target_os = "windows"))]
52+
assert_eq!(result, "/");
4853
}
4954

5055
#[test]

0 commit comments

Comments
 (0)