Skip to content

Commit 62c8429

Browse files
author
David Orchard
committed
Create test cases to demonstrate lossy map order
1 parent 74a0a80 commit 62c8429

21 files changed

+151
-34
lines changed

tests/Settings.hjson

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
rating: 4.5
1212
creator: {
1313
name: John Smith
14+
username: jsmith
15+
email: jsmith@localhost
1416
}
1517
}
1618
}

tests/Settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"reviews": 3866,
1212
"rating": 4.5,
1313
"creator": {
14-
"name": "John Smith"
14+
"name": "John Smith",
15+
"username": "jsmith",
16+
"email": "jsmith@localhost"
1517
}
1618
}
1719
}

tests/Settings.json5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
rating: 4.5,
1414
creator: {
1515
name: "John Smith",
16+
"username": "jsmith",
17+
"email": "jsmith@localhost",
1618
}
1719
}
1820
}

tests/Settings.ron

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
rating: Some(4.5),
1313
telephone: None,
1414
creator: {
15-
"name": "John Smith"
15+
"name": "John Smith",
16+
"username": "jsmith",
17+
"email": "jsmith@localhost"
1618
}
1719
)
1820
)

tests/Settings.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ rating = 4.5
4141

4242
[place.creator]
4343
name = "John Smith"
44+
username = "jsmith"
45+
email = "jsmith@localhost"
4446

4547
[proton]
4648
up = 2

tests/Settings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ place:
1010
rating: 4.5
1111
creator:
1212
name: John Smith
13+
username: jsmith
14+
email: jsmith@localhost

tests/file_hjson.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,15 @@ fn test_file() {
6060
assert_eq!(s.elements.len(), 10);
6161
assert_eq!(s.elements[3], "4".to_string());
6262
assert_eq!(
63-
s.place.creator["name"].clone().into_string().unwrap(),
64-
"John Smith".to_string()
63+
s.place
64+
.creator
65+
.into_iter()
66+
.collect::<Vec<(String, config::Value)>>(),
67+
vec![
68+
("name".to_string(), "John Smith".into()),
69+
("username".into(), "jsmith".into()),
70+
("email".into(), "jsmith@localhost".into()),
71+
]
6572
);
6673
}
6774

tests/file_json.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,15 @@ fn test_file() {
6060
assert_eq!(s.elements.len(), 10);
6161
assert_eq!(s.elements[3], "4".to_string());
6262
assert_eq!(
63-
s.place.creator["name"].clone().into_string().unwrap(),
64-
"John Smith".to_string()
63+
s.place
64+
.creator
65+
.into_iter()
66+
.collect::<Vec<(String, config::Value)>>(),
67+
vec![
68+
("name".to_string(), "John Smith".into()),
69+
("username".into(), "jsmith".into()),
70+
("email".into(), "jsmith@localhost".into()),
71+
]
6572
);
6673
}
6774

tests/file_json5.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,15 @@ fn test_file() {
5959
assert_eq!(s.elements.len(), 10);
6060
assert_eq!(s.elements[3], "4".to_string());
6161
assert_eq!(
62-
s.place.creator["name"].clone().into_string().unwrap(),
63-
"John Smith".to_string()
62+
s.place
63+
.creator
64+
.into_iter()
65+
.collect::<Vec<(String, config::Value)>>(),
66+
vec![
67+
("name".to_string(), "John Smith".into()),
68+
("username".into(), "jsmith".into()),
69+
("email".into(), "jsmith@localhost".into()),
70+
]
6471
);
6572
}
6673

tests/file_ron.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,15 @@ fn test_file() {
6262
assert_eq!(s.elements.len(), 10);
6363
assert_eq!(s.elements[3], "4".to_string());
6464
assert_eq!(
65-
s.place.creator["name"].clone().into_string().unwrap(),
66-
"John Smith".to_string()
65+
s.place
66+
.creator
67+
.into_iter()
68+
.collect::<Vec<(String, config::Value)>>(),
69+
vec![
70+
("name".to_string(), "John Smith".into()),
71+
("username".into(), "jsmith".into()),
72+
("email".into(), "jsmith@localhost".into()),
73+
]
6774
);
6875
}
6976

0 commit comments

Comments
 (0)