Skip to content

Commit f40b57a

Browse files
authored
Stop using the SWIFT_PM_SUPPORTS_SWIFT_TESTING flag. (#376)
When we were first bringing up experimental support for swift-testing in Swift Package Manager, I added the flag `SWIFT_PM_SUPPORTS_SWIFT_TESTING` to the build process for test targets so that we could detect if there was built-in support or not. Now that we've announced we're aligning our release with Swift 6, we can instead just check if the compiler is Swift 6 or later. Very early Swift 5.11 toolchain builds did not have support, but they have long since been superseded. ### 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 5318033 commit f40b57a

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Sources/Testing/Running/XCTestScaffold.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extension XCTIssue {
7676
/// ## See Also
7777
///
7878
/// - <doc:TemporaryGettingStarted>
79-
#if SWIFT_PM_SUPPORTS_SWIFT_TESTING
79+
#if compiler(>=5.11)
8080
@available(*, deprecated, message: "This version of Swift Package Manager supports running swift-testing tests directly. This type will be removed in a future release.")
8181
#else
8282
@available(swift, deprecated: 100000.0, message: "This type is provided temporarily to aid in integrating the testing library with existing tools such as Swift Package Manager. It will be removed in a future release.")
@@ -109,13 +109,13 @@ public enum XCTestScaffold: Sendable {
109109
/// ## See Also
110110
///
111111
/// - <doc:TemporaryGettingStarted>
112-
#if SWIFT_PM_SUPPORTS_SWIFT_TESTING
112+
#if compiler(>=5.11)
113113
@available(*, deprecated, message: "This version of Swift Package Manager supports running swift-testing tests directly. This function has no effect and will be removed in a future release.")
114114
#else
115115
@available(swift, deprecated: 100000.0, message: "This function is provided temporarily to aid in integrating the testing library with existing tools such as Swift Package Manager. It will be removed in a future release.")
116116
#endif
117117
public static func runAllTests(hostedBy testCase: XCTestCase, _ functionName: String = #function) async {
118-
#if SWIFT_PM_SUPPORTS_SWIFT_TESTING
118+
#if compiler(>=5.11)
119119
let message = Event.ConsoleOutputRecorder.warning(
120120
"This version of Swift Package Manager supports running swift-testing tests directly. Ignoring call to \(#function).",
121121
options: .for(.stderr)

Tests/TestingMacrosTests/TestSupport/Scaffolding.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
//
1010

11-
#if !SWT_NO_XCTEST_SCAFFOLDING && !SWIFT_PM_SUPPORTS_SWIFT_TESTING && canImport(XCTest)
11+
#if !SWT_NO_XCTEST_SCAFFOLDING && compiler(<5.11) && canImport(XCTest)
1212
import XCTest
1313
import Testing
1414

Tests/TestingTests/ExitTestTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private import TestingInternals
4444
#endif
4545
}
4646

47-
#if SWIFT_PM_SUPPORTS_SWIFT_TESTING
47+
#if compiler(>=5.11)
4848
@Test("Exit tests (failing)") func failing() async {
4949
let expectedCount: Int
5050
#if os(Windows)

Tests/TestingTests/TestSupport/Scaffolding.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
99
//
1010

11-
#if !SWT_NO_XCTEST_SCAFFOLDING && !SWIFT_PM_SUPPORTS_SWIFT_TESTING && canImport(XCTest)
11+
#if !SWT_NO_XCTEST_SCAFFOLDING && compiler(<5.11) && canImport(XCTest)
1212
import XCTest
1313
import Testing
1414

Tests/TestingTests/Traits/TagListTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct TagListTests {
222222
#expect(Tag.Color.rgb(0, 0, 0) < .rgb(100, 100, 100))
223223
}
224224

225-
#if !SWT_NO_EXIT_TESTS && SWIFT_PM_SUPPORTS_SWIFT_TESTING && !canImport(SwiftSyntax600)
225+
#if !SWT_NO_EXIT_TESTS && compiler(>=5.11) && !canImport(SwiftSyntax600)
226226
@Test("Invalid symbolic tag declaration")
227227
func invalidSymbolicTag() async {
228228
await #expect(exitsWith: .failure) {

0 commit comments

Comments
 (0)