mirror of
https://github.com/nushell/nushell.git
synced 2025-08-16 02:28:36 +02:00
1882-Add min, max in addition to average for acting lists (#1969)
* Converting average.rs to math.rs * Making some progress towards math Examples and unit tests failing, also think I found a bug with passing in strings * Fix typos * Found issue with negative numbers * Add some comments * Split commands like in split and str_ but do not register? * register commands in cli * Address clippy warnings * Fix bad examples * Make the example failure message more helpful * Replace unwraps * Use compare_values to avoid coercion issues * Remove unneeded code
This commit is contained in:
@ -7,11 +7,11 @@ fn can_average_numbers() {
|
||||
r#"
|
||||
open sgml_description.json
|
||||
| get glossary.GlossDiv.GlossList.GlossEntry.Sections
|
||||
| average
|
||||
| math average
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
println!("{:?}", actual.err);
|
||||
assert_eq!(actual.out, "101.5")
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ fn can_average_numbers() {
|
||||
fn can_average_bytes() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats",
|
||||
"ls | sort-by name | skip 1 | first 2 | get size | average | format \"{$it}\" | echo $it"
|
||||
"ls | sort-by name | skip 1 | first 2 | get size | math average | format \"{$it}\" | echo $it"
|
||||
);
|
||||
|
||||
assert_eq!(actual.out, "1.6 KB");
|
||||
|
Reference in New Issue
Block a user