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};
|
2019-12-15 17:15:06 +01:00
|
|
|
|
|
|
|
#[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
|
|
|
|
"#,
|
|
|
|
)]);
|
2019-12-15 17:15:06 +01:00
|
|
|
|
2020-05-24 08:41:30 +02:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: dirs.test(), pipeline(
|
|
|
|
r#"
|
|
|
|
open sample.txt
|
|
|
|
| lines
|
|
|
|
| trim
|
|
|
|
| split column ","
|
2020-07-06 17:27:01 +02:00
|
|
|
| get Column2
|
2020-05-24 08:41:30 +02:00
|
|
|
| echo $it
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert!(actual.out.contains("shipper"));
|
|
|
|
})
|
2019-12-15 17:15:06 +01:00
|
|
|
}
|