2019-12-17 19:54:39 +01:00
|
|
|
// use nu_test_support::{nu, pipeline};
|
|
|
|
// use nu_test_support::playground::Playground;
|
|
|
|
// use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
|
2019-12-15 17:15:06 +01:00
|
|
|
|
|
|
|
// #[test]
|
|
|
|
// fn can_sum() {
|
|
|
|
// let actual = nu!(
|
|
|
|
// cwd: "tests/fixtures/formats", h::pipeline(
|
|
|
|
// r#"
|
|
|
|
// open sgml_description.json
|
|
|
|
// | get glossary.GlossDiv.GlossList.GlossEntry.Sections
|
|
|
|
// | sum
|
|
|
|
// | echo $it
|
|
|
|
// "#
|
|
|
|
// ));
|
|
|
|
|
|
|
|
// assert_eq!(actual, "203")
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #[test]
|
|
|
|
// fn can_average_numbers() {
|
|
|
|
// let actual = nu!(
|
|
|
|
// cwd: "tests/fixtures/formats", h::pipeline(
|
|
|
|
// r#"
|
|
|
|
// open sgml_description.json
|
|
|
|
// | get glossary.GlossDiv.GlossList.GlossEntry.Sections
|
|
|
|
// | average
|
|
|
|
// | echo $it
|
|
|
|
// "#
|
|
|
|
// ));
|
|
|
|
|
|
|
|
// assert_eq!(actual, "101.5000000000000")
|
|
|
|
// }
|
|
|
|
|
|
|
|
// #[test]
|
|
|
|
// fn can_average_bytes() {
|
|
|
|
// let actual = nu!(
|
|
|
|
// cwd: "tests/fixtures/formats",
|
|
|
|
// "ls | sort-by name | skip 1 | first 2 | get size | average | echo $it"
|
|
|
|
// );
|
|
|
|
|
|
|
|
// assert_eq!(actual, "1600.000000000000");
|
|
|
|
// }
|