diff options
Diffstat (limited to 'tests/legacy/file_json.rs')
-rw-r--r-- | tests/legacy/file_json.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/tests/legacy/file_json.rs b/tests/legacy/file_json.rs index ed2a54f..597e948 100644 --- a/tests/legacy/file_json.rs +++ b/tests/legacy/file_json.rs @@ -4,7 +4,6 @@ extern crate config; extern crate float_cmp; extern crate serde; -use linked_hash_map::LinkedHashMap; use std::path::PathBuf; use self::config::*; @@ -18,7 +17,7 @@ struct Place { favorite: bool, telephone: Option<String>, reviews: u64, - creator: LinkedHashMap<String, Value>, + creator: MapImpl<String, Value>, rating: Option<f32>, } @@ -57,14 +56,21 @@ fn test_file() { assert_eq!(s.place.telephone, None); assert_eq!(s.elements.len(), 10); assert_eq!(s.elements[3], "4".to_string()); - assert_eq!( - s.place.creator.into_iter().collect::<Vec<(String, config::Value)>>(), - vec![ - ("name".to_string(), "John Smith".into()), - ("username".into(), "jsmith".into()), - ("email".into(), "jsmith@localhost".into()), - ] - ); + if cfg!(feature = "preserve_order") { + assert_eq!( + s.place.creator.into_iter().collect::<Vec<(String, config::Value)>>(), + vec![ + ("name".to_string(), "John Smith".into()), + ("username".into(), "jsmith".into()), + ("email".into(), "jsmith@localhost".into()), + ] + ); + } else { + assert_eq!( + s.place.creator["name"].clone().into_string().unwrap(), + "John Smith".to_string() + ); + } } #[test] |