1747 add ns to duration (#2128)

* Added nanos to Duration

* Removed unwraps

* Added nanos to Duration

* Removed unwraps

* Fixed errors

* Removed unwraps

* Changed serialization to String

* Fixed Date and Duration comparison
This commit is contained in:
Pierre-André Gagnon
2020-07-10 13:48:11 -04:00
committed by GitHub
parent 6a89b1b010
commit e07a9e4ee7
18 changed files with 263 additions and 98 deletions

View File

@ -168,7 +168,31 @@ fn duration_math() {
"#
));
assert_eq!(actual.out, "8:00:00:00");
assert_eq!(actual.out, "8:00:00:00.0");
}
#[test]
fn duration_math_with_nanoseconds() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
= 1w + 10ns
"#
));
assert_eq!(actual.out, "7:00:00:00.00000001");
}
#[test]
fn duration_math_with_negative() {
let actual = nu!(
cwd: "tests/fixtures/formats", pipeline(
r#"
= 1d - 1w
"#
));
assert_eq!(actual.out, "-6:00:00:00.0");
}
#[test]