diff options
author | David Orchard <if_coding@fastmail.com> | 2021-07-28 22:49:48 -0700 |
---|---|---|
committer | David Orchard <if_coding@fastmail.com> | 2021-08-15 10:31:10 -0700 |
commit | 62c84297e5340d717d89c5c0b36ed86dd5ad9d2f (patch) | |
tree | e3062f57dfb10b921267aeeed5df6b42d93a4657 /tests/merge.rs | |
parent | 74a0a809f642e2d212752c9ccb767d987c42302e (diff) |
Create test cases to demonstrate lossy map order
Diffstat (limited to 'tests/merge.rs')
-rw-r--r-- | tests/merge.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/merge.rs b/tests/merge.rs index 9de36b2..8d09417 100644 --- a/tests/merge.rs +++ b/tests/merge.rs @@ -2,6 +2,8 @@ extern crate config; +use std::collections::HashMap; + use config::*; fn make() -> Config { @@ -18,11 +20,17 @@ fn test_merge() { assert_eq!(c.get("debug").ok(), Some(false)); assert_eq!(c.get("production").ok(), Some(true)); + assert_eq!(c.get("place.rating").ok(), Some(4.9)); + + let m: HashMap<String, String> = c.get("place.creator").unwrap(); assert_eq!( - c.get("place.creator.name").ok(), - Some("Somebody New".to_string()) + m.into_iter().collect::<Vec<(String, String)>>(), + vec![ + ("name".to_string(), "Somebody New".to_string()), + ("username".to_string(), "jsmith".to_string()), + ("email".to_string(), "jsmith@localhost".to_string()), + ] ); - assert_eq!(c.get("place.rating").ok(), Some(4.9)); } #[test] |