mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 17:25:15 +02:00
Split split command to sub commands.
This commit is contained in:
29
crates/nu-cli/tests/commands/split_row.rs
Normal file
29
crates/nu-cli/tests/commands/split_row.rs
Normal file
@ -0,0 +1,29 @@
|
||||
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
||||
use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn to_row() {
|
||||
Playground::setup("split_row_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"sample.txt",
|
||||
r#"
|
||||
importer,shipper,tariff_item,name,origin
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open sample.txt
|
||||
| lines
|
||||
| trim
|
||||
| split row ","
|
||||
| count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains("5"));
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user