Skip to content

Commit

Permalink
Do not run tests checking Objective-C parameter when not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephDuffy committed Feb 11, 2024
1 parent 793d76c commit 5eb9994
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Tests/HashableMacroTests/HashableMacroTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,7 @@ final class HashableMacroTests: XCTestCase {

func testIsEqualToTypeFunctionNameInvalidType() throws {
#if canImport(HashableMacroMacros)
#if canImport(ObjectiveC)
assertMacro(testMacros) {
"""
@Hashable(isEqualToTypeFunctionName: 123, _disableNSObjectSubclassSupport: false)
Expand All @@ -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)
Expand All @@ -1300,13 +1304,18 @@ 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 testIsEqualToTypeFunctionNameInvalidCustomNameType() throws {
#if canImport(HashableMacroMacros)
#if canImport(ObjectiveC)
assertMacro(testMacros) {
"""
@Hashable(isEqualToTypeFunctionName: .custom(123), _disableNSObjectSubclassSupport: false)
Expand All @@ -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)
Expand All @@ -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
}
Expand Down

0 comments on commit 5eb9994

Please sign in to comment.