Skip to content

Commit dc8103b

Browse files
Merge pull request #395 from matthiasbeyer/fix-tests-chrono
Fix: Do not use deprecated function
2 parents 7f0dbef + 5d9cb27 commit dc8103b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tests/datetime.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,25 +86,25 @@ fn test_datetime() {
8686
// JSON
8787
let date: DateTime<Utc> = s.get("json_datetime").unwrap();
8888

89-
assert_eq!(date, Utc.ymd(2017, 5, 10).and_hms(2, 14, 53));
89+
assert_eq!(date, Utc.with_ymd_and_hms(2017, 5, 10, 2, 14, 53).unwrap());
9090

9191
// TOML
9292
let date: DateTime<Utc> = s.get("toml_datetime").unwrap();
9393

94-
assert_eq!(date, Utc.ymd(2017, 5, 11).and_hms(14, 55, 15));
94+
assert_eq!(date, Utc.with_ymd_and_hms(2017, 5, 11, 14, 55, 15).unwrap());
9595

9696
// YAML
9797
let date: DateTime<Utc> = s.get("yaml_datetime").unwrap();
9898

99-
assert_eq!(date, Utc.ymd(2017, 6, 12).and_hms(10, 58, 30));
99+
assert_eq!(date, Utc.with_ymd_and_hms(2017, 6, 12, 10, 58, 30).unwrap());
100100

101101
// INI
102102
let date: DateTime<Utc> = s.get("ini_datetime").unwrap();
103103

104-
assert_eq!(date, Utc.ymd(2017, 5, 10).and_hms(2, 14, 53));
104+
assert_eq!(date, Utc.with_ymd_and_hms(2017, 5, 10, 2, 14, 53).unwrap());
105105

106106
// RON
107107
let date: DateTime<Utc> = s.get("ron_datetime").unwrap();
108108

109-
assert_eq!(date, Utc.ymd(2021, 4, 19).and_hms(11, 33, 2));
109+
assert_eq!(date, Utc.with_ymd_and_hms(2021, 4, 19, 11, 33, 2).unwrap());
110110
}

0 commit comments

Comments
 (0)