From 5eb9994c06ab318d87e997554e86e2c645f218ab Mon Sep 17 00:00:00 2001 From: Joseph Duffy Date: Sun, 11 Feb 2024 10:34:59 -0800 Subject: [PATCH] Do not run tests checking Objective-C parameter when not supported --- Tests/HashableMacroTests/HashableMacroTests.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tests/HashableMacroTests/HashableMacroTests.swift b/Tests/HashableMacroTests/HashableMacroTests.swift index 080e5f3..3070e28 100644 --- a/Tests/HashableMacroTests/HashableMacroTests.swift +++ b/Tests/HashableMacroTests/HashableMacroTests.swift @@ -1255,6 +1255,7 @@ final class HashableMacroTests: XCTestCase { func testIsEqualToTypeFunctionNameInvalidType() throws { #if canImport(HashableMacroMacros) + #if canImport(ObjectiveC) assertMacro(testMacros) { """ @Hashable(isEqualToTypeFunctionName: 123, _disableNSObjectSubclassSupport: false) @@ -1275,12 +1276,15 @@ final class HashableMacroTests: XCTestCase { """ } #else + throw XCTSkip("This expansion requires Objective-C") + #endif throw XCTSkip("Macros are only supported when running tests for the host platform") #endif } func testIsEqualToTypeFunctionNameInvalidName() throws { #if canImport(HashableMacroMacros) + #if canImport(ObjectiveC) assertMacro(testMacros) { """ @Hashable(isEqualToTypeFunctionName: .invalidName, _disableNSObjectSubclassSupport: false) @@ -1300,6 +1304,10 @@ final class HashableMacroTests: XCTestCase { } """ } + + #else + throw XCTSkip("This expansion requires Objective-C") + #endif #else throw XCTSkip("Macros are only supported when running tests for the host platform") #endif @@ -1307,6 +1315,7 @@ final class HashableMacroTests: XCTestCase { func testIsEqualToTypeFunctionNameInvalidCustomNameType() throws { #if canImport(HashableMacroMacros) + #if canImport(ObjectiveC) assertMacro(testMacros) { """ @Hashable(isEqualToTypeFunctionName: .custom(123), _disableNSObjectSubclassSupport: false) @@ -1327,12 +1336,16 @@ final class HashableMacroTests: XCTestCase { """ } #else + throw XCTSkip("This expansion requires Objective-C") + #endif + #else throw XCTSkip("Macros are only supported when running tests for the host platform") #endif } func testIsEqualToTypeFunctionNameInvalidCustomNameParameterCount() throws { #if canImport(HashableMacroMacros) + #if canImport(ObjectiveC) assertMacro(testMacros) { """ @Hashable(isEqualToTypeFunctionName: .custom("name1", "name2"), _disableNSObjectSubclassSupport: false) @@ -1353,6 +1366,8 @@ final class HashableMacroTests: XCTestCase { """ } #else + throw XCTSkip("This expansion requires Objective-C") + #endif throw XCTSkip("Macros are only supported when running tests for the host platform") #endif }