Skip to content

Commit 59c7ad0

Browse files
committed
Extend test cases a bit
1 parent d819ac2 commit 59c7ad0

1 file changed

Lines changed: 27 additions & 19 deletions

File tree

src/object.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,32 +1691,40 @@ mod tests {
16911691
fn test_arrays_no_pretty() {
16921692
test_obj_no_pretty!(|obj| obj.array(), b"[]");
16931693
test_obj_no_pretty!(
1694-
|obj| obj
1695-
.array()
1696-
.item(12)
1697-
.item(Name(b"Hi"))
1698-
.item(Name(b"Hi2"))
1699-
.item(false)
1700-
.item(TextStr("A string"))
1701-
.item(Null)
1702-
.item(23.40),
1703-
b"[12/Hi/Hi2 false(A String)null 23.4]"
1694+
|obj| {
1695+
let mut arr = obj.array();
1696+
1697+
arr.item(12)
1698+
.item(Name(b"Hi"))
1699+
.item(Name(b"Hi2"))
1700+
.item(false)
1701+
.item(TextStr("A string"));
1702+
1703+
arr.push().dict().pair(Name(b"Test1"), 23);
1704+
1705+
arr.item(Null).item(23.40);
1706+
1707+
arr
1708+
},
1709+
b"[12/Hi/Hi2 false(A string)<</Test1 23>>null 23.4]"
17041710
);
17051711
}
17061712

17071713
#[test]
17081714
fn test_dicts_no_pretty() {
17091715
test_obj_no_pretty!(|obj| obj.dict(), b"<<>>");
17101716
test_obj_no_pretty!(
1711-
|obj| obj
1712-
.dict()
1713-
.pair(Name(b"Key1"), 12)
1714-
.pair(Name(b"Key2"), Name(b"Hi"))
1715-
.pair(Name(b"Key3"), false)
1716-
.pair(Name(b"Key4"), TextStr("A string"))
1717-
.pair(Name(b"Key5"), Null)
1718-
.pair(Name(b"Key6"), 23.40),
1719-
b"<</Key1 12/Key2/Hi/Key3 false/Key4(A string)/Key5 null/Key6 23.4>>"
1717+
|obj| {
1718+
let mut dict = obj.dict();
1719+
dict.pair(Name(b"Key1"), 12)
1720+
.pair(Name(b"Key2"), Name(b"Hi"))
1721+
.pair(Name(b"Key3"), false)
1722+
.pair(Name(b"Key4"), TextStr("A string"));
1723+
dict.insert(Name(b"Key5")).array().item(23).item(Name(b"Value"));
1724+
dict.pair(Name(b"Key6"), Null)
1725+
.pair(Name(b"Key7"), 23.40)
1726+
},
1727+
b"<</Key1 12/Key2/Hi/Key3 false/Key4(A string)/Key5[23/Value]/Key6 null/Key7 23.4>>"
17201728
);
17211729
}
17221730
}

0 commit comments

Comments
 (0)