mirror of
https://github.com/nushell/nushell.git
synced 2024-12-12 02:02:32 +01:00
5ac5b90aed
Co-authored-by: Antoine Stevan <44101798+amtoine@users.noreply.github.com>
38 lines
704 B
Rust
38 lines
704 B
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn splits_empty_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
echo '' | path split | is-empty
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "true");
|
|
}
|
|
|
|
#[test]
|
|
fn splits_correctly_single_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
'home/viking/spam.txt'
|
|
| path split
|
|
| last
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "spam.txt");
|
|
}
|
|
|
|
#[test]
|
|
fn splits_correctly_single_path_const() {
|
|
let actual = nu!(r#"
|
|
const result = ('home/viking/spam.txt' | path split);
|
|
$result | last
|
|
"#);
|
|
|
|
assert_eq!(actual.out, "spam.txt");
|
|
}
|