summaryrefslogtreecommitdiffstats
path: root/tests/file_json5.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/file_json5.rs')
-rw-r--r--tests/file_json5.rs32
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/file_json5.rs b/tests/file_json5.rs
index f92bce5..cb04718 100644
--- a/tests/file_json5.rs
+++ b/tests/file_json5.rs
@@ -9,7 +9,6 @@ extern crate serde_derive;
use config::*;
use float_cmp::ApproxEqUlps;
-use linked_hash_map::LinkedHashMap;
use std::path::PathBuf;
#[derive(Debug, Deserialize)]
@@ -20,7 +19,7 @@ struct Place {
favorite: bool,
telephone: Option<String>,
reviews: u64,
- creator: LinkedHashMap<String, Value>,
+ creator: MapImpl<String, Value>,
rating: Option<f32>,
}
@@ -58,17 +57,24 @@ 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]