Skip to content

Commit

Permalink
tests: add negative non-zero duration test
Browse files Browse the repository at this point in the history
  • Loading branch information
kartva committed Sep 6, 2024
1 parent c3c2c99 commit 1eba9d3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions components/experimental/src/duration/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,5 +757,20 @@ mod tests {
.into_owned(),
"0 yrs"
);

let negative_non_zero_duration = Duration {
sign: DurationSign::Negative,
years: 0,
months: 1,
..Default::default()
};

assert_eq!(
formatter
.format(&negative_non_zero_duration)
.write_to_string()
.into_owned(),
"-0 yrs, 1 mth"
);
}
}

0 comments on commit 1eba9d3

Please sign in to comment.