mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 14:06:40 +02:00
histogram: support regular values. (#2300)
This commit is contained in:
committed by
GitHub
parent
c48c092125
commit
7f35bfc005
@ -3,7 +3,7 @@ use nu_test_support::playground::Playground;
|
||||
use nu_test_support::{nu, pipeline};
|
||||
|
||||
#[test]
|
||||
fn summarizes() {
|
||||
fn summarizes_by_column_given() {
|
||||
Playground::setup("histogram_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_caballeros.csv",
|
||||
@ -34,9 +34,38 @@ fn summarizes() {
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn summarizes_by_values() {
|
||||
Playground::setup("histogram_test_2", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_caballeros.csv",
|
||||
r#"
|
||||
first_name,last_name,rusty_at
|
||||
Andrés,Robalino,Ecuador
|
||||
Jonathan,Turner,Estados Unidos
|
||||
Yehuda,Katz,Estados Unidos
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.csv
|
||||
| get rusty_at
|
||||
| histogram
|
||||
| where value == "Estados Unidos"
|
||||
| get count
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "2");
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help() {
|
||||
Playground::setup("histogram_test_help", |dirs, _sandbox| {
|
||||
Playground::setup("histogram_test_3", |dirs, _sandbox| {
|
||||
let help_command = nu!(
|
||||
cwd: dirs.test(), pipeline(
|
||||
r#"
|
||||
|
Reference in New Issue
Block a user