mirror of
https://github.com/nushell/nushell
synced 2024-12-26 13:03:07 +00:00
219b7e64cd
Add tests for ~tilde expansion: - test that "~" is expanded (no more "~" in output) - ensure that "1~1" is not expanded to "1/home/user1" as it was before Fixes #972 Note: the first test does not check the literal expansion because the path on Windows is expanded as a Linux path, but the correct expansion may come for free once `shellexpand` will use the `dirs` crate too (https://github.com/netvl/shellexpand/issues/3).
42 lines
765 B
Rust
42 lines
765 B
Rust
mod helpers;
|
|
|
|
use helpers::Playground;
|
|
|
|
#[test]
|
|
fn external_command() {
|
|
let actual = nu!(
|
|
cwd: "tests/fixtures",
|
|
"echo 1"
|
|
);
|
|
|
|
assert!(actual.contains("1"));
|
|
}
|
|
|
|
#[test]
|
|
fn spawn_external_process_with_home_in_arguments() {
|
|
Playground::setup("echo_tilde", |dirs, _| {
|
|
let actual = nu!(
|
|
cwd: dirs.test(),
|
|
r#"
|
|
sh -c "echo ~"
|
|
"#
|
|
);
|
|
|
|
assert!(
|
|
!actual.contains("~"),
|
|
format!("'{}' should not contain ~", actual)
|
|
);
|
|
})
|
|
}
|
|
|
|
#[test]
|
|
fn spawn_external_process_with_tilde_in_arguments() {
|
|
let actual = nu!(
|
|
cwd: "tests/fixtures",
|
|
r#"
|
|
sh -c "echo 1~1"
|
|
"#
|
|
);
|
|
|
|
assert_eq!(actual, "1~1");
|
|
}
|