mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 14:28:11 +02:00
Command tests (#922)
* WIP command tests * Finish marking todo tests * update * update * Windows cd test ignoring
This commit is contained in:
28
crates/nu-command/tests/commands/split_row.rs
Normal file
28
crates/nu-command/tests/commands/split_row.rs
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
||||
| str trim
|
||||
| split row ","
|
||||
| length
|
||||
"#
|
||||
));
|
||||
|
||||
assert!(actual.out.contains('5'));
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user