2020-07-05 19:46:06 +02:00
|
|
|
use nu_test_support::{nu, pipeline};
|
2020-04-26 08:34:45 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn drop_rows() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: "tests/fixtures/formats",
|
2020-10-26 07:55:52 +01:00
|
|
|
r#"echo '[{"foo": 3}, {"foo": 8}, {"foo": 4}]' | from json | drop 2 | get foo | math sum "#
|
2020-04-26 08:34:45 +02:00
|
|
|
);
|
|
|
|
|
2020-05-07 13:03:43 +02:00
|
|
|
assert_eq!(actual.out, "3");
|
2020-04-26 08:34:45 +02:00
|
|
|
}
|
2020-07-05 19:46:06 +02:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn drop_more_rows_than_table_has() {
|
|
|
|
let actual = nu!(
|
|
|
|
cwd: ".", pipeline(
|
|
|
|
r#"
|
|
|
|
date | drop 50 | count
|
|
|
|
"#
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_eq!(actual.out, "0");
|
|
|
|
}
|