mirror of
https://github.com/nushell/nushell.git
synced 2025-08-18 20:19:01 +02:00
Move filesize to use bigint (#2984)
* Move filesize to be bigint-sized * Add tests and fix filesize display * clippy
This commit is contained in:
@@ -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!(
|
||||
|
Reference in New Issue
Block a user