Skip to content

Commit 048d0c3

Browse files
committed
Be more assertive in NestingTests (#44)
1 parent b1b6c27 commit 048d0c3

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

Tests/XMLCoderTests/NestingTests.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,34 +118,30 @@ final class NestingTests: XCTestCase {
118118

119119
func testDecodeUnkeyedWithinUnkeyed() throws {
120120
let encoded = xmlUnkeyedWithinUnkeyed.data(using: .utf8)!
121-
let expected = [[1, 2, 3], [1, 2, 3]]
121+
let expected = unkeyedWithinUnkeyed
122122
let decoded = try decoder.decode([[Int]].self, from: encoded)
123-
124-
XCTAssertNoThrow(try decoder.decode(type(of: unkeyedWithinUnkeyed), from: encoded))
123+
XCTAssertEqual(decoded, expected)
125124
}
126125

127126
func testDecodeUnkeyedWithinKeyed() throws {
128127
let encoded = xmlUnkeyedWithinKeyed.data(using: .utf8)!
129-
let expected = ["first": [1, 2, 3], "second": [1, 2, 3]]
128+
let expected = unkeyedWithinKeyed
130129
let decoded = try decoder.decode([String: [Int]].self, from: encoded)
131-
132-
XCTAssertNoThrow(try decoder.decode(type(of: unkeyedWithinKeyed), from: encoded))
130+
XCTAssertEqual(decoded, expected)
133131
}
134132

135133
func testDecodeKeyedWithinUnkeyed() throws {
136134
let encoded = xmlKeyedWithinUnkeyed.data(using: .utf8)!
137-
let expected = [["first": 1], ["second": 2]]
135+
let expected = keyedWithinUnkeyed
138136
let decoded = try decoder.decode([[String: Int]].self, from: encoded)
139-
140-
XCTAssertNoThrow(try decoder.decode(type(of: keyedWithinUnkeyed), from: encoded))
137+
XCTAssertEqual(decoded, expected)
141138
}
142139

143140
func testDecodeKeyedWithinKeyed() throws {
144141
let encoded = xmlKeyedWithinKeyed.data(using: .utf8)!
145-
let expected = ["first": ["a": 1, "b": 2], "second": ["c": 3, "d": 4]]
142+
let expected = keyedWithinKeyed
146143
let decoded = try decoder.decode([String: [String: Int]].self, from: encoded)
147-
148-
XCTAssertNoThrow(try decoder.decode(type(of: keyedWithinKeyed), from: encoded))
144+
XCTAssertEqual(decoded, expected)
149145
}
150146

151147
static var allTests = [

0 commit comments

Comments
 (0)