Added a count column on the histogram command (#1853)

* Adding iniitial draft for the addition of the count column on the histogram command

* Update histogram documentation

* Add count column test to histogram command

* Fix error in histogram documentation
This commit is contained in:
Joseph T. Lyons
2020-05-20 02:02:36 -04:00
committed by GitHub
parent b22db39775
commit 3239e5055c
3 changed files with 103 additions and 44 deletions

View File

@ -62,3 +62,22 @@ fn help() {
assert_eq!(help_long.out, help_command.out);
})
}
#[test]
fn count() {
let actual = nu!(
cwd: ".", pipeline(
r#"
echo "[{"bit":1},{"bit":0},{"bit":0},{"bit":0},{"bit":0},{"bit":0},{"bit":0},{"bit":1}]"
| from json
| histogram bit
| sort-by count
| reject frequency
| to json
"#
));
let bit_json = r#"[{"bit":"1","count":2},{"bit":"0","count":6}]"#;
assert_eq!(actual.out, bit_json);
}