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

29 lines
735 B
Rust
Raw Normal View History

2020-05-24 06:41:30 +00:00
use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
2019-12-17 18:54:39 +00:00
use nu_test_support::{nu, pipeline};
#[test]
2020-05-24 06:41:30 +00: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 06:41:30 +00:00
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
open sample.txt
| lines
| str trim
2020-05-24 06:41:30 +00:00
| split column ","
2020-07-06 15:27:01 +00:00
| get Column2
2020-05-24 06:41:30 +00:00
"#
));
assert!(actual.out.contains("shipper"));
})
}