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};
|
2019-12-15 16:15:06 +00:00
|
|
|
|
|
|
|
#[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
|
|
|
|
"#,
|
|
|
|
)]);
|
2019-12-15 16:15:06 +00:00
|
|
|
|
2020-05-24 06:41:30 +00:00
|
|
|
let actual = nu!(
|
|
|
|
cwd: dirs.test(), pipeline(
|
|
|
|
r#"
|
|
|
|
open sample.txt
|
|
|
|
| lines
|
2020-09-16 19:59:32 +00:00
|
|
|
| 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"));
|
|
|
|
})
|
2019-12-15 16:15:06 +00:00
|
|
|
}
|