mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Parse decimal units (#3243)
* parse decimal units * linting * stop clippy complaining * Added tests to parsing decimals * Fixed bug * Fixed testing and add more
This commit is contained in:
@ -187,6 +187,18 @@ fn duration_math() {
|
||||
assert_eq!(actual.out, "8day");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duration_decimal_math() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
= 0.5mon + 1day
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "16day");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duration_math_with_nanoseconds() {
|
||||
let actual = nu!(
|
||||
@ -199,6 +211,18 @@ fn duration_math_with_nanoseconds() {
|
||||
assert_eq!(actual.out, "7day 10ns");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duration_decimal_math_with_nanoseconds() {
|
||||
let actual = nu!(
|
||||
cwd: "tests/fixtures/formats", pipeline(
|
||||
r#"
|
||||
= 1.5wk + 10ns
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual.out, "10day 10ns");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn duration_math_with_negative() {
|
||||
let actual = nu!(
|
||||
|
Reference in New Issue
Block a user