nushell/crates/nu-command/tests/commands/take/rows.rs

32 lines
768 B
Rust
Raw Normal View History

use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, pipeline};
#[test]
fn rows() {
2022-04-07 22:49:28 +02:00
Playground::setup("take_test_1", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"caballeros.csv",
r#"
name,lucky_code
Andrés,1
Jonathan,1
Jason,2
Yehuda,1
"#,
)]);
let actual = nu!(
cwd: dirs.test(), pipeline(
r#"
open caballeros.csv
2022-04-07 22:49:28 +02:00
| take 3
| get lucky_code
| math sum
"#
));
assert_eq!(actual.out, "4");
})
}