Custom canonicalize method on Filesystem Shell. (#1485)

* Custom canonicalize method for FilesystemShell.

* Use custom canonicalize method.
Fixed missing import.

* Move function body to already impl body.

* Create test that aims to resolve.
This commit is contained in:
Kevin DCR
2020-03-16 01:28:18 -05:00
committed by GitHub
parent 45a3afdc79
commit 8d19b21b9f
2 changed files with 48 additions and 4 deletions

View File

@ -85,6 +85,28 @@ fn filesystem_change_current_directory_to_parent_directory() {
})
}
#[test]
fn filesystem_change_current_directory_to_parent_directory_after_delete_cwd() {
Playground::setup("cd_test_5_1", |dirs, sandbox| {
sandbox.within("foo").mkdir("bar");
let actual = nu!(
cwd: dirs.test().join("foo/bar"),
r#"
rm {}/foo/bar
echo ","
cd ..
pwd | echo $it
"#,
dirs.test()
);
let actual = actual.split(',').nth(1).unwrap();
assert_eq!(PathBuf::from(actual), *dirs.test().join("foo"));
})
}
#[test]
fn filesystem_change_to_home_directory() {
Playground::setup("cd_test_6", |dirs, _| {