From 9826b2cda730116e148120dafe0fa89bd389626e Mon Sep 17 00:00:00 2001 From: Raphael Cohn Date: Fri, 1 Sep 2017 09:06:27 +0100 Subject: Added HJSON (Human-Readable JSON) as a config file format --- tests/datetime.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/datetime.rs') 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 = s.get("yaml_datetime").unwrap(); assert_eq!(date, Utc.ymd(2017, 6, 12).and_hms(10, 58, 30)); + + // HJSON + let date: DateTime = s.get("hjson_datetime").unwrap(); + + assert_eq!(date, Utc.ymd(2017, 5, 10).and_hms(2, 14, 53)); } -- cgit v1.2.3