Skip to content

Commit f5b64a3

Browse files
authored
Fix macro expansion failure for a non-copyable suite type with a test method. (#739)
If a non-copyable suite type has a test function whose name starts with `test`, we emit a call to `__invokeXCTestCaseMethod()` that's a no-op (but we can't tell during macro expansion if it will be.) This function needs to be updated to accept a non-copyable generic type. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 1b04184 commit f5b64a3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Sources/Testing/Test+Macro.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public func __ifMainActorIsolationEnforced<R>(
568568
_ selector: __XCTestCompatibleSelector?,
569569
onInstanceOf type: T.Type,
570570
sourceLocation: SourceLocation
571-
) async throws -> Bool {
571+
) async throws -> Bool where T: ~Copyable {
572572
false
573573
}
574574

Tests/TestingTests/NonCopyableSuiteTests.swift

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct NonCopyableTests: ~Copyable {
1616
@Test borrowing func borrowMe() {}
1717
@Test consuming func consumeMe() {}
1818
@Test mutating func mutateMe() {}
19+
@Test borrowing func testNotAnXCTestCaseMethod() {}
1920

2021
@Test borrowing func typeComparison() {
2122
let lhs = TypeInfo(describing: Self.self)

0 commit comments

Comments
 (0)