diff options
author | Raphael Cohn <raphael.cohn@stormmq.com> | 2017-09-01 09:06:27 +0100 |
---|---|---|
committer | Raphael Cohn <raphael.cohn@stormmq.com> | 2017-09-01 09:06:27 +0100 |
commit | 9826b2cda730116e148120dafe0fa89bd389626e (patch) | |
tree | 164597d8e40017ca690c259c75eacee9134f6f5d /tests/datetime.rs | |
parent | 13151213a7b368296c616e0a770fb2c238fff1a0 (diff) |
Added HJSON (Human-Readable JSON) as a config file format
Diffstat (limited to 'tests/datetime.rs')
-rw-r--r-- | tests/datetime.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/datetime.rs b/tests/datetime.rs index 8a50c01..89a34a1 100644 --- a/tests/datetime.rs +++ b/tests/datetime.rs @@ -29,6 +29,15 @@ fn make() -> Config { FileFormat::Toml, )) .unwrap() + .merge(File::from_str( + r#" + { + "hjson_datetime": "2017-05-10T02:14:53Z" + } + "#, + FileFormat::Hjson, + )) + .unwrap() .clone() } @@ -50,6 +59,11 @@ fn test_datetime_string() { let date: String = s.get("yaml_datetime").unwrap(); assert_eq!(&date, "2017-06-12T10:58:30Z"); + + // HJSON + let date: String = s.get("hjson_datetime").unwrap(); + + assert_eq!(&date, "2017-05-10T02:14:53Z"); } #[test] @@ -70,4 +84,9 @@ fn test_datetime() { let date: DateTime<Utc> = s.get("yaml_datetime").unwrap(); assert_eq!(date, Utc.ymd(2017, 6, 12).and_hms(10, 58, 30)); + + // HJSON + let date: DateTime<Utc> = s.get("hjson_datetime").unwrap(); + + assert_eq!(date, Utc.ymd(2017, 5, 10).and_hms(2, 14, 53)); } |