mirror of
https://github.com/nushell/nushell
synced 2025-01-04 01:09:05 +00:00
cc3653cfd9
* Change path join signature * Appending now works without flag * Column path operation is behind a -c flag * Move column path arg retrieval to a function Also improves errors * Fix path join tests * Propagate column path changes to all path commands * Update path command examples with columns paths * Modernize path command examples by removing "echo" * Improve structured path error message * Fix typo
47 lines
930 B
Rust
47 lines
930 B
Rust
use nu_test_support::{nu, pipeline};
|
|
|
|
#[test]
|
|
fn splits_empty_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
echo '' | path split
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "");
|
|
}
|
|
|
|
#[test]
|
|
fn splits_correctly_single_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
echo ['home/viking/spam.txt']
|
|
| path split
|
|
| last
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "spam.txt");
|
|
}
|
|
|
|
#[test]
|
|
fn splits_correctly_with_column_path() {
|
|
let actual = nu!(
|
|
cwd: "tests", pipeline(
|
|
r#"
|
|
echo [
|
|
[home, barn];
|
|
|
|
['home/viking/spam.txt', 'barn/cow/moo.png']
|
|
['home/viking/eggs.txt', 'barn/goat/cheese.png']
|
|
]
|
|
| path split -c [ home barn ]
|
|
| get barn
|
|
| length
|
|
"#
|
|
));
|
|
|
|
assert_eq!(actual.out, "6");
|
|
}
|