Skip to content

Commit 61238ed

Browse files
committed
Uses the expectCrash instead of xfail in the Encoder Tests
1 parent 02df514 commit 61238ed

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

test/stdlib/TestJSONEncoder.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ class TestJSONEncoder : TestJSONEncoderSuper {
193193
let model = Model.testValue
194194
// This following test would fail as it attempts to re-encode into already encoded container is invalid. This will always fail
195195
if #available(OSX 10.13, iOS 11.0, watchOS 4.0, tvOS 11.0, *) {
196-
let expectedJSON = "{\"top\":{\"first\":\"Johnny Appleseed\",\"second\":\"[email protected]\"}}".data(using: .utf8)!
197196
_testEncodeFailure(of: model)
198197
} else {
199198
_testEncodeFailure(of: model)
@@ -1713,10 +1712,10 @@ JSONEncoderTests.test("testEncodingTopLevelDeepStructuredType") { TestJSONEncode
17131712
JSONEncoderTests.test("testEncodingClassWhichSharesEncoderWithSuper") { TestJSONEncoder().testEncodingClassWhichSharesEncoderWithSuper() }
17141713
JSONEncoderTests.test("testEncodingTopLevelNullableType") { TestJSONEncoder().testEncodingTopLevelNullableType() }
17151714
JSONEncoderTests.test("testEncodingMultipleNestedContainersWithTheSameTopLevelKey") { TestJSONEncoder().testEncodingMultipleNestedContainersWithTheSameTopLevelKey() }
1716-
JSONEncoderTests.test("testEncodingConflictedTypeNestedContainersWithTheSameTopLevelKey")
1717-
.xfail(.always("Attempt to re-encode into already encoded container is invalid. This will always fail"))
1718-
.code {
1715+
JSONEncoderTests.test("testEncodingConflictedTypeNestedContainersWithTheSameTopLevelKey") {
1716+
expectCrash() {
17191717
TestJSONEncoder().testEncodingConflictedTypeNestedContainersWithTheSameTopLevelKey()
1718+
}
17201719
}
17211720
JSONEncoderTests.test("testEncodingOutputFormattingDefault") { TestJSONEncoder().testEncodingOutputFormattingDefault() }
17221721
JSONEncoderTests.test("testEncodingOutputFormattingPrettyPrinted") { TestJSONEncoder().testEncodingOutputFormattingPrettyPrinted() }

test/stdlib/TestPlistEncoder.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -874,10 +874,10 @@ PropertyListEncoderTests.test("testEncodingTopLevelDeepStructuredType") { TestPr
874874
PropertyListEncoderTests.test("testEncodingClassWhichSharesEncoderWithSuper") { TestPropertyListEncoder().testEncodingClassWhichSharesEncoderWithSuper() }
875875
PropertyListEncoderTests.test("testEncodingTopLevelNullableType") { TestPropertyListEncoder().testEncodingTopLevelNullableType() }
876876
PropertyListEncoderTests.test("testEncodingMultipleNestedContainersWithTheSameTopLevelKey") { TestPropertyListEncoder().testEncodingMultipleNestedContainersWithTheSameTopLevelKey() }
877-
PropertyListEncoderTests.test("testEncodingConflictedTypeNestedContainersWithTheSameTopLevelKey")
878-
.xfail(.always("Attempt to re-encode into already encoded container is invalid. This will always fail"))
879-
.code {
877+
PropertyListEncoderTests.test("testEncodingConflictedTypeNestedContainersWithTheSameTopLevelKey") {
878+
expectCrash() {
880879
TestPropertyListEncoder().testEncodingConflictedTypeNestedContainersWithTheSameTopLevelKey()
880+
}
881881
}
882882
PropertyListEncoderTests.test("testNestedContainerCodingPaths") { TestPropertyListEncoder().testNestedContainerCodingPaths() }
883883
PropertyListEncoderTests.test("testSuperEncoderCodingPaths") { TestPropertyListEncoder().testSuperEncoderCodingPaths() }

0 commit comments

Comments
 (0)