Can group cells by given column name.

This commit is contained in:
Andrés N. Robalino
2019-10-20 18:42:07 -05:00
parent 8923e91e39
commit 0611f56776
6 changed files with 93 additions and 1 deletions

View File

@@ -3,6 +3,34 @@ mod helpers;
use helpers as h;
use helpers::{Playground, Stub::*};
#[test]
fn group_by() {
Playground::setup("group_by_test_1", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed(
"los_tres_caballeros.csv",
r#"
first_name,last_name,rusty_luck,type
Andrés,Robalino,1,A
Jonathan,Turner,1,B
Yehuda,Katz,1,A
"#,
)]);
let actual = nu!(
cwd: dirs.test(), h::pipeline(
r#"
open los_tres_caballeros.csv
| group-by type
| get A
| count
| echo $it
"#
));
assert_eq!(actual, "2");
})
}
#[test]
fn first_gets_first_rows_by_amount() {
Playground::setup("first_test_1", |dirs, sandbox| {