@@ -13,7 +13,7 @@ struct SwiftCustomNSError: Error, CustomNSError {
13
13
class TestNSError : XCTestCase {
14
14
15
15
static var allTests : [ ( String , ( TestNSError ) -> ( ) throws -> Void ) ] {
16
- return [
16
+ var tests : [ ( String , ( TestNSError ) -> ( ) throws -> Void ) ] = [
17
17
( " test_LocalizedError_errorDescription " , test_LocalizedError_errorDescription) ,
18
18
( " test_NSErrorAsError_localizedDescription " , test_NSErrorAsError_localizedDescription) ,
19
19
( " test_NSError_inDictionary " , test_NSError_inDictionary) ,
@@ -23,12 +23,19 @@ class TestNSError : XCTestCase {
23
23
( " test_CustomNSError_errorCodeRawInt " , test_CustomNSError_errorCodeRawInt) ,
24
24
( " test_CustomNSError_errorCodeRawUInt " , test_CustomNSError_errorCodeRawUInt) ,
25
25
( " test_errorConvenience " , test_errorConvenience) ,
26
+ ]
27
+
28
+ #if !canImport(ObjectiveC) || DARWIN_COMPATIBILITY_TESTS
29
+ tests. append ( contentsOf: [
26
30
( " test_ConvertErrorToNSError_domain " , test_ConvertErrorToNSError_domain) ,
27
31
( " test_ConvertErrorToNSError_errorCode " , test_ConvertErrorToNSError_errorCode) ,
28
32
( " test_ConvertErrorToNSError_errorCodeRawInt " , test_ConvertErrorToNSError_errorCodeRawInt) ,
29
33
( " test_ConvertErrorToNSError_errorCodeRawUInt " , test_ConvertErrorToNSError_errorCodeRawUInt) ,
30
34
( " test_ConvertErrorToNSError_errorCodeWithAssosiatedValue " , test_ConvertErrorToNSError_errorCodeWithAssosiatedValue) ,
31
- ]
35
+ ] )
36
+ #endif
37
+
38
+ return tests
32
39
}
33
40
34
41
func test_LocalizedError_errorDescription( ) {
@@ -112,6 +119,8 @@ class TestNSError : XCTestCase {
112
119
}
113
120
}
114
121
122
+ #if !canImport(ObjectiveC) || DARWIN_COMPATIBILITY_TESTS
123
+
115
124
func test_ConvertErrorToNSError_domain( ) {
116
125
struct CustomSwiftError : Error {
117
126
}
@@ -164,6 +173,8 @@ class TestNSError : XCTestCase {
164
173
XCTAssertEqual ( ( SwiftError . four as NSError ) . code, 4 )
165
174
XCTAssertEqual ( ( SwiftError . five ( " five " ) as NSError ) . code, 1 )
166
175
}
176
+
177
+ #endif
167
178
168
179
}
169
180
0 commit comments