Skip to content

Commit

Permalink
Make the generated discovered test code compile without concurrency w…
Browse files Browse the repository at this point in the history
…arnings.

PiperOrigin-RevId: 667570499
  • Loading branch information
allevato authored and swiple-rules-gardener committed Aug 26, 2024
1 parent 6d0fc0f commit 1dd927f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/test_discoverer/SymbolGraphTestPrinter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct SymbolGraphTestPrinter {

var contents = """
import XCTest
@testable import \(moduleName)
@preconcurrency @testable import \(moduleName)
"""

Expand All @@ -78,6 +78,7 @@ struct SymbolGraphTestPrinter {
fileprivate extension \(className) {
\(availabilityAttribute)
@MainActor
static let \(allTestsIdentifier(for: testClass)) = [
"""
Expand All @@ -99,6 +100,7 @@ struct SymbolGraphTestPrinter {
contents += """
\(availabilityAttribute)
@MainActor
let \(allTestsIdentifier(for: discoveredModule)) = [
"""
Expand Down Expand Up @@ -127,13 +129,15 @@ struct SymbolGraphTestPrinter {
// harmlessly compiled as an empty module, and the user's `main` from their own sources will
// be used instead.
return """
@MainActor
private let __allDiscoveredXCTests: [XCTestCaseEntry] = []
"""
}

var contents = """
\(availabilityAttribute)
@MainActor
private let __allDiscoveredXCTests: [XCTestCaseEntry] = {
var allTests: [XCTestCaseEntry] = []
Expand Down

1 comment on commit 1dd927f

@brentleyjones
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.