nushell/crates/nu-command/tests/commands/split_column.rs

29 lines
735 B
Rust
Raw Normal View History

2020-05-24 08:41:30 +02:00
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
2019-12-17 19:54:39 +01:00
use nu_test_support::{nu, pipeline};
#[test]
2020-05-24 08:41:30 +02:00
fn to_column() {
Playground::setup("split_column_test_1", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"sample.txt",
r#"
importer,shipper,tariff_item,name,origin
"#,
)]);
2020-05-24 08:41:30 +02:00
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
open sample.txt
| lines
| str trim
2020-05-24 08:41:30 +02:00
| split column ","
2020-07-06 17:27:01 +02:00
| get Column2
2020-05-24 08:41:30 +02:00
"#
));
assert!(actual.out.contains("shipper"));
})
}