Skip to content

Commit a26d6e4

Browse files
committed
Lower macOS availability of async APIs from 12.0 to 10.15
After async test support was added to this version of XCTest in swiftlang#331, the Swift async/await feature became available in older Apple OSes, and on macOS specifically it changed from requiring 12.0 to 10.15. So this lowers the availability of all macOS 12.0 requirements of async APIs to 10.15.
1 parent 9302bff commit a26d6e4

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Sources/XCTest/Private/XCTestCase.TearDownBlocksState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension XCTestCase {
1919
// which can unexpectedly change their semantics in difficult to track down ways.
2020
//
2121
// Because of this, we chose the unusual decision to forgo overloading (which is a super sweet language feature <3) to prevent this issue from surprising any contributors to corelibs-xctest
22-
@available(macOS 12.0, *)
22+
@available(macOS 10.15, *)
2323
func appendAsync(_ block: @Sendable @escaping () async throws -> Void) {
2424
self.append {
2525
try awaitUsingExpectation { try await block() }

Sources/XCTest/Public/XCAbstractTest.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ open class XCTest {
5353
}
5454

5555
/// Async setup method called before the invocation of `setUpWithError` for each test method in the class.
56-
@available(macOS 12.0, *)
56+
@available(macOS 10.15, *)
5757
open func setUp() async throws {}
5858
/// Setup method called before the invocation of `setUp` and the test method
5959
/// for each test method in the class.
@@ -73,7 +73,7 @@ open class XCTest {
7373

7474
/// Async teardown method which is called after the invocation of `tearDownWithError`
7575
/// for each test method in the class.
76-
@available(macOS 12.0, *)
76+
@available(macOS 10.15, *)
7777
open func tearDown() async throws {}
7878
// FIXME: This initializer is required due to a Swift compiler bug on Linux.
7979
// It should be removed once the bug is fixed.

Sources/XCTest/Public/XCTestCase.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ open class XCTestCase: XCTest {
206206

207207
/// Registers a block of teardown code to be run after the current test
208208
/// method ends.
209-
@available(macOS 12.0, *)
209+
@available(macOS 10.15, *)
210210
public func addTeardownBlock(_ block: @Sendable @escaping () async throws -> Void) {
211211
teardownBlocksState.appendAsync(block)
212212
}
@@ -227,7 +227,7 @@ open class XCTestCase: XCTest {
227227
}
228228

229229
do {
230-
if #available(macOS 12.0, *) {
230+
if #available(macOS 10.15, *) {
231231
try awaitUsingExpectation {
232232
try await self.setUp()
233233
}
@@ -273,7 +273,7 @@ open class XCTestCase: XCTest {
273273
}
274274

275275
do {
276-
if #available(macOS 12.0, *) {
276+
if #available(macOS 10.15, *) {
277277
try awaitUsingExpectation {
278278
try await self.tearDown()
279279
}
@@ -321,7 +321,7 @@ private func test<T: XCTestCase>(_ testFunc: @escaping (T) -> () throws -> Void)
321321
}
322322
}
323323

324-
@available(macOS 12.0, *)
324+
@available(macOS 10.15, *)
325325
public func asyncTest<T: XCTestCase>(
326326
_ testClosureGenerator: @escaping (T) -> () async throws -> Void
327327
) -> (T) -> () throws -> Void {
@@ -333,7 +333,7 @@ public func asyncTest<T: XCTestCase>(
333333
}
334334
}
335335

336-
@available(macOS 12.0, *)
336+
@available(macOS 10.15, *)
337337
func awaitUsingExpectation(
338338
_ closure: @escaping () async throws -> Void
339339
) throws -> Void {

0 commit comments

Comments
 (0)