2020-05-24 08:41:30 +02:00
|
|
|
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
|
2020-09-16 21:59:32 +02:00
|
|
|
| str trim
|
2020-05-24 08:41:30 +02:00
|
|
|
| split row ","
|
|
|
|
| count
|
|
|
|
| echo $it
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
2020-05-27 06:50:26 +02:00
|
|
|
assert!(actual.out.contains('5'));
|
2020-05-24 08:41:30 +02:00
|
|
|
})
|
|
|
|
}
|