Skip to content

Commit

Permalink
add more (but technically duplicate) tests for time parsing and forma…
Browse files Browse the repository at this point in the history
…tting
  • Loading branch information
Byron committed Jul 30, 2024
1 parent 1d37bf6 commit 9d5d8a6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
17 changes: 14 additions & 3 deletions gix-date/tests/time/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ fn unix() {

#[test]
fn raw() {
let expected = "123456789 +0230";
assert_eq!(time().format(Format::Raw), expected);
assert_eq!(time().format(format::RAW), expected);
for (time, expected) in [
(time(), "123456789 +0230"),
(
Time {
seconds: 1112911993,
offset: 3600,
sign: Sign::Plus,
},
"1112911993 +0100",
),
] {
assert_eq!(time.format(Format::Raw), expected);
assert_eq!(time.format(format::RAW), expected);
}
}

#[test]
Expand Down
9 changes: 9 additions & 0 deletions gix-date/tests/time/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ fn raw() {
},
);

assert_eq!(
gix_date::parse("1112911993 +0100", None).unwrap(),
Time {
seconds: 1112911993,
offset: 3600,
sign: Sign::Plus,
},
);

let expected = Time {
seconds: 1660874655,
offset: -28800,
Expand Down

0 comments on commit 9d5d8a6

Please sign in to comment.