From e7e3a7592402cce8ca71e0382855430cf5c418a7 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 20 Jun 2017 20:42:01 +0200 Subject: [PATCH] Add another JSON test for an empty JSON --- .../src/file_abstraction/stdio/mapper/json.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libimagstore/src/file_abstraction/stdio/mapper/json.rs b/libimagstore/src/file_abstraction/stdio/mapper/json.rs index b3772b85..a153df08 100644 --- a/libimagstore/src/file_abstraction/stdio/mapper/json.rs +++ b/libimagstore/src/file_abstraction/stdio/mapper/json.rs @@ -153,6 +153,18 @@ mod test { use super::*; + #[test] + fn test_empty_json_to_fs() { + let json = r#"{"version":"0.3.0","store":{}}"#; + let mut json = Cursor::new(String::from(json).into_bytes()); + let mapper = JsonMapper::new(); + let mut hm = HashMap::new(); + + let io_res = mapper.read_to_fs(&mut json, &mut hm); + assert!(io_res.is_ok()); + assert!(hm.is_empty()); + } + #[test] fn test_json_to_fs() { let json = r#"