Move path handling to nu-path (#3653)

* fixes #3616
This commit is contained in:
Niklas Jonsson
2021-06-20 01:07:26 +02:00
committed by GitHub
parent b9f1371994
commit a8f6a13239
24 changed files with 645 additions and 465 deletions

View File

@ -43,3 +43,36 @@ fn expands_path_with_double_dot() {
assert_eq!(PathBuf::from(actual.out), expected);
})
}
#[cfg(windows)]
mod windows {
use super::*;
#[test]
fn expands_path_with_tilde_backward_slash() {
Playground::setup("path_expand_2", |dirs, _| {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "~\tmp.txt" | path expand
"#
));
assert!(!PathBuf::from(actual.out).starts_with("~"));
})
}
#[test]
fn win_expands_path_with_tilde_forward_slash() {
Playground::setup("path_expand_2", |dirs, _| {
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
echo "~/tmp.txt" | path expand
"#
));
assert!(!PathBuf::from(actual.out).starts_with("~"));
})
}
}