Skip to content

Commit 9d5d8a6

Browse files
committed
add more (but technically duplicate) tests for time parsing and formatting
1 parent 1d37bf6 commit 9d5d8a6

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

gix-date/tests/time/format.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,20 @@ fn unix() {
1717

1818
#[test]
1919
fn raw() {
20-
let expected = "123456789 +0230";
21-
assert_eq!(time().format(Format::Raw), expected);
22-
assert_eq!(time().format(format::RAW), expected);
20+
for (time, expected) in [
21+
(time(), "123456789 +0230"),
22+
(
23+
Time {
24+
seconds: 1112911993,
25+
offset: 3600,
26+
sign: Sign::Plus,
27+
},
28+
"1112911993 +0100",
29+
),
30+
] {
31+
assert_eq!(time.format(Format::Raw), expected);
32+
assert_eq!(time.format(format::RAW), expected);
33+
}
2334
}
2435

2536
#[test]

gix-date/tests/time/parse.rs

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ fn raw() {
6767
},
6868
);
6969

70+
assert_eq!(
71+
gix_date::parse("1112911993 +0100", None).unwrap(),
72+
Time {
73+
seconds: 1112911993,
74+
offset: 3600,
75+
sign: Sign::Plus,
76+
},
77+
);
78+
7079
let expected = Time {
7180
seconds: 1660874655,
7281
offset: -28800,

0 commit comments

Comments
 (0)