mirror of
https://github.com/nushell/nushell
synced 2025-01-27 20:35:43 +00:00
Test case for cd
This commit is contained in:
parent
d7fdf96eb1
commit
3122d918bc
1 changed files with 36 additions and 0 deletions
|
@ -323,3 +323,39 @@ fn pwd_recovery() {
|
||||||
|
|
||||||
assert_eq!(actual.out, "/");
|
assert_eq!(actual.out, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
#[test]
|
||||||
|
fn filesystem_from_non_root_change_to_another_drive_non_root_then_using_relative_path_go_back() {
|
||||||
|
Playground::setup("cd_test_22", |dirs, sandbox| {
|
||||||
|
sandbox.mkdir("test_folder");
|
||||||
|
|
||||||
|
let _actual = nu!(
|
||||||
|
cwd: dirs.test(),
|
||||||
|
r#"
|
||||||
|
touch test_folder/test_file.txt
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
assert!(dirs.test.exists());
|
||||||
|
assert!(dirs.test.join("test_folder").exists());
|
||||||
|
assert!(dirs.test.join("test_folder").join("test_file.txt").exists());
|
||||||
|
let _actual = nu!(
|
||||||
|
cwd: dirs.test(),
|
||||||
|
r#"
|
||||||
|
subst X: /D | touch out
|
||||||
|
subst X: test_folder
|
||||||
|
cd x:
|
||||||
|
touch test_file_on_x.txt
|
||||||
|
echo $env.PWD
|
||||||
|
cd -
|
||||||
|
subst X: /D | touch out
|
||||||
|
echo $env.PWD
|
||||||
|
"#
|
||||||
|
);
|
||||||
|
assert!(dirs.test.exists());
|
||||||
|
assert!(dirs.test.join("test_folder").exists());
|
||||||
|
assert!(_actual.out.ends_with(r"\cd_test_22"));
|
||||||
|
assert!(_actual.err.is_empty());
|
||||||
|
assert!(dirs.test.join("test_folder").join("test_file_on_x.txt").exists());
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue