mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 06:30:08 +02:00
expand durations to include month, year, decade (#6123)
* expand durations to include month, year, decade * remove commented out fn * oops, found more debug comments * tweaked tests for the new way, borrowed heavily from chrono-humanize-rs * clippy * grammar
This commit is contained in:
@ -291,7 +291,7 @@ fn duration_math() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "8day");
|
||||
assert_eq!(actual.out, "1wk 1day");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -315,7 +315,7 @@ fn duration_math_with_nanoseconds() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "7day 10ns");
|
||||
assert_eq!(actual.out, "1wk 10ns");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -327,7 +327,22 @@ fn duration_decimal_math_with_nanoseconds() {
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "10day 10ns");
|
||||
assert_eq!(actual.out, "1wk 3day 10ns");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duration_decimal_math_with_all_units() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
5dec + 3yr + 2month + 1wk + 3day + 8hr + 10min + 16sec + 121ms + 11us + 12ns
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
"53yr 2month 1wk 3day 8hr 10min 16sec 121ms 11µs 12ns"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user