Move filesize to use bigint (#2984)

* Move filesize to be bigint-sized

* Add tests and fix filesize display

* clippy
This commit is contained in:
Jonathan Turner
2021-01-30 11:35:18 +13:00
committed by GitHub
parent 7b4cbd7ce9
commit 44e088c6fe
17 changed files with 227 additions and 148 deletions

View File

@@ -750,6 +750,53 @@ fn range_with_mixed_types() {
assert_eq!(actual.out, "55");
}
#[test]
fn filesize_math() {
let actual = nu!(
cwd: ".",
r#"
= 100 * 10kb
"#
);
assert_eq!(actual.out, "1.0 MB");
}
#[test]
fn filesize_math2() {
let actual = nu!(
cwd: ".",
r#"
= 100 / 10kb
"#
);
assert!(actual.err.contains("Coercion"));
}
#[test]
fn filesize_math3() {
let actual = nu!(
cwd: ".",
r#"
= 100kb / 10
"#
);
assert_eq!(actual.out, "10.2 KB");
}
#[test]
fn filesize_math4() {
let actual = nu!(
cwd: ".",
r#"
= 100kb * 5
"#
);
assert_eq!(actual.out, "512.0 KB");
}
#[test]
fn exclusive_range_with_mixed_types() {
let actual = nu!(