Add test case for 'save'

This commit is contained in:
Zhenping Zhao 2024-12-21 03:29:50 -08:00
parent 63168465b8
commit 4f761e7cc9
2 changed files with 26 additions and 1 deletions

View file

@ -884,7 +884,6 @@ fn support_pwd_per_drive() {
open test_folder\result.out.txt
"#
);
eprintln!("std out: {}", _actual.out);
assert_eq!(_actual.out, r"X:\test_folder_on_x\test_file_on_x.txt");
assert!(_actual.err.is_empty());
})

View file

@ -525,3 +525,29 @@ fn parent_redirection_doesnt_affect_save() {
assert_eq!(actual.trim_end(), "");
})
}
#[cfg(windows)]
#[test]
fn support_pwd_per_drive() {
Playground::setup("save_test_pwd_per_drive", |dirs, sandbox| {
sandbox.mkdir("test_folder");
let _actual = nu!(
cwd: dirs.test(),
r#"
subst X: /D | touch out
subst X: test_folder
x:
mkdir test_folder_on_x
cd -
x:test_folder_on_x\
touch test_file_on_x.txt
cd -
ls test_folder | get name | save x:result.out.txt
subst X: /D | touch out
open test_folder\test_folder_on_x\result.out.txt
"#
);
assert_eq!(_actual.out, r"test_folder\test_folder_on_x");
assert!(_actual.err.is_empty());
})
}