nushell/crates/nu-cli/tests/commands/drop.rs
Joseph T. Lyons 85d848dd7d
Stream results of drop command (#2114)
* Stream results of drop command

* When the amount of rows to drop is equal to or greaten than the size of the table, output nothing
2020-07-06 05:46:06 +12:00

24 lines
471 B
Rust

use nu_test_support::{nu, pipeline};
#[test]
fn drop_rows() {
let actual = nu!(
cwd: "tests/fixtures/formats",
r#"echo '[{"foo": 3}, {"foo": 8}, {"foo": 4}]' | from json | drop 2 | get foo | math sum | echo $it"#
);
assert_eq!(actual.out, "3");
}
#[test]
fn drop_more_rows_than_table_has() {
let actual = nu!(
cwd: ".", pipeline(
r#"
date | drop 50 | count
"#
));
assert_eq!(actual.out, "0");
}