Skip to content

Commit f7a4aa4

Browse files
committed
Deploy 0.2.0
1 parent 3fa4ea0 commit f7a4aa4

17 files changed

+59
-78
lines changed

Package.swift

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,7 @@ let package = Package(
6464
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
6565
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
6666
],
67-
swiftSettings: .packageSettings + [
68-
// The only target which needs the ability to import this macro
69-
// implementation target's module is its unit test target. Users of the
70-
// macros this target implements use them via their declarations in the
71-
// Testing module. This target's module is never distributed to users,
72-
// but as an additional guard against accidental misuse, this specifies
73-
// the unit test target as the only allowable client.
74-
.unsafeFlags(["-Xfrontend", "-allowable-client", "-Xfrontend", "TestingMacrosTests"]),
75-
]
67+
swiftSettings: .packageSettings
7668
),
7769

7870
// "Support" targets: These contain C family code and are used exclusively
@@ -117,17 +109,6 @@ extension Array where Element == PackageDescription.SwiftSetting {
117109
/// Analogous to project-level build settings in an Xcode project.
118110
static var packageSettings: Self {
119111
[
120-
.unsafeFlags([
121-
"-require-explicit-sendable",
122-
123-
"-Xfrontend", "-define-availability", "-Xfrontend", "_mangledTypeNameAPI:macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0",
124-
"-Xfrontend", "-define-availability", "-Xfrontend", "_backtraceAsyncAPI:macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0",
125-
"-Xfrontend", "-define-availability", "-Xfrontend", "_clockAPI:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0",
126-
"-Xfrontend", "-define-availability", "-Xfrontend", "_regexAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0",
127-
"-Xfrontend", "-define-availability", "-Xfrontend", "_swiftVersionAPI:macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0",
128-
129-
"-Xfrontend", "-define-availability", "-Xfrontend", "_distantFuture:macOS 99.0, iOS 99.0, watchOS 99.0, tvOS 99.0",
130-
]),
131112
.enableExperimentalFeature("StrictConcurrency"),
132113
.enableUpcomingFeature("ExistentialAny"),
133114

Sources/Testing/Events/Clock.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ extension Test {
5959
// MARK: -
6060

6161
@_spi(ExperimentalEventHandling)
62-
@available(_clockAPI, *)
62+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
6363
extension SuspendingClock.Instant {
6464
/// Initialize this instant to the equivalent of the same instant on the
6565
/// testing library's clock.
@@ -89,7 +89,7 @@ extension Test.Clock.Instant {
8989
/// The value of this property is the equivalent of `self` on the wall clock.
9090
/// It is suitable for display to the user, but not for fine timing
9191
/// calculations.
92-
@available(_clockAPI, *)
92+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
9393
public var durationSince1970: Duration {
9494
Duration(wall)
9595
}
@@ -126,7 +126,7 @@ extension Test.Clock {
126126
/// This function is not part of the public interface of the testing library.
127127
/// It is primarily used by the testing library's own tests. External clients
128128
/// can use ``sleep(for:tolerance:)`` or ``sleep(until:tolerance:)`` instead.
129-
@available(_clockAPI, *)
129+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
130130
static func sleep(for duration: Duration) async throws {
131131
#if SWT_NO_UNSTRUCTURED_TASKS
132132
let timeValue = TimeValue(duration)
@@ -145,7 +145,7 @@ extension Test.Clock {
145145
// MARK: - Clock
146146

147147
@_spi(ExperimentalEventHandling)
148-
@available(_clockAPI, *)
148+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
149149
extension Test.Clock: _Concurrency.Clock {
150150
public typealias Duration = SuspendingClock.Duration
151151

@@ -193,7 +193,7 @@ extension Test.Clock.Instant: Equatable, Hashable, Comparable {
193193
// MARK: - InstantProtocol
194194

195195
@_spi(ExperimentalEventHandling)
196-
@available(_clockAPI, *)
196+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
197197
extension Test.Clock.Instant: InstantProtocol {
198198
public typealias Duration = Swift.Duration
199199

Sources/Testing/Events/TimeValue.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ struct TimeValue: Sendable {
4545
self.init((Int64(timespec.tv_sec), Int64(timespec.tv_nsec) * 1_000_000_000))
4646
}
4747

48-
@available(_clockAPI, *)
48+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
4949
init(_ duration: Duration) {
5050
self.init(duration.components)
5151
}
5252

53-
@available(_clockAPI, *)
53+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
5454
init(_ instant: SuspendingClock.Instant) {
5555
self.init(unsafeBitCast(instant, to: Duration.self))
5656
}
@@ -93,14 +93,14 @@ extension TimeValue: CustomStringConvertible {
9393

9494
// MARK: -
9595

96-
@available(_clockAPI, *)
96+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
9797
extension Duration {
9898
init(_ timeValue: TimeValue) {
9999
self.init(secondsComponent: timeValue.seconds, attosecondsComponent: timeValue.attoseconds)
100100
}
101101
}
102102

103-
@available(_clockAPI, *)
103+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
104104
extension SuspendingClock.Instant {
105105
init(_ timeValue: TimeValue) {
106106
self = unsafeBitCast(Duration(timeValue), to: SuspendingClock.Instant.self)

Sources/Testing/Expectations/ExpectationChecking+Macro.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ public func __checkClosureCall<R>(
785785
private func _description(of error: some Error) -> String {
786786
let errorDescription = "\"\(error)\""
787787
let errorType = type(of: error as Any)
788-
if #available(_regexAPI, *) {
788+
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
789789
if errorDescription.contains(String(describing: errorType)) {
790790
return errorDescription
791791
}

Sources/Testing/Running/Configuration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public struct Configuration: Sendable {
4242
///
4343
/// To determine the actual time limit that applies to an instance of
4444
/// ``Test`` at runtime, use ``Test/adjustedTimeLimit(configuration:)``.
45-
@available(_clockAPI, *)
45+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
4646
public var defaultTestTimeLimit: Duration? {
4747
get {
4848
_defaultTestTimeLimit as? Duration
@@ -64,7 +64,7 @@ public struct Configuration: Sendable {
6464
///
6565
/// To determine the actual time limit that applies to an instance of
6666
/// ``Test`` at runtime, use ``Test/adjustedTimeLimit(configuration:)``.
67-
@available(_clockAPI, *)
67+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
6868
public var maximumTestTimeLimit: Duration? {
6969
get {
7070
_maximumTestTimeLimit as? Duration
@@ -82,7 +82,7 @@ public struct Configuration: Sendable {
8282
/// By default, test time limit granularity is limited to intervals of one
8383
/// minute (60 seconds.) If finer or coarser granularity is required, the
8484
/// value of this property can be adjusted.
85-
@available(_clockAPI, *)
85+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
8686
public var testTimeLimitGranularity: Duration {
8787
get {
8888
(_testTimeLimitGranularity as? Duration) ?? .seconds(60)

Sources/Testing/Running/EntryPoint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func configurationForSwiftPMEntryPoint(withArguments args: [String]) throws -> C
172172
// constructed solely from a string, they are safe to send across isolation
173173
// boundaries.
174174
var filters = [Configuration.TestFilter]()
175-
if #available(_regexAPI, *) {
175+
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
176176
if let filterArgIndex = args.firstIndex(of: "--filter"), filterArgIndex < args.endIndex {
177177
let filterArg = args[args.index(after: filterArgIndex)]
178178

Sources/Testing/SourceAttribution/Backtrace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public struct Backtrace: Sendable {
6363
let addresses = [UnsafeRawPointer?](unsafeUninitializedCapacity: addressCount) { addresses, initializedCount in
6464
addresses.withMemoryRebound(to: UnsafeMutableRawPointer?.self) { addresses in
6565
#if SWT_TARGET_OS_APPLE
66-
if #available(_backtraceAsyncAPI, *) {
66+
if #available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *) {
6767
initializedCount = backtrace_async(addresses.baseAddress!, addresses.count, nil)
6868
} else {
6969
initializedCount = .init(backtrace(addresses.baseAddress!, .init(addresses.count)))

Sources/Testing/SourceAttribution/CustomTestStringConvertible.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,13 @@ extension String {
107107
self.init(describing: value)
108108
} else if let value = value as? any CustomDebugStringConvertible {
109109
self.init(reflecting: value)
110-
} else if #available(_mangledTypeNameAPI, *), let value = value as? any RawRepresentable, isImportedFromC(valueType) {
110+
} else if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *), let value = value as? any RawRepresentable, isImportedFromC(valueType) {
111111
// Present raw-representable C types, which we assume to be imported
112112
// enumerations, in a consistent fashion. The case names of C enumerations
113113
// are not statically visible, so instead present the enumeration type's
114114
// name along with the raw value of `value`.
115115
self = "\(valueType)(rawValue: \(String(describingForTest: value.rawValue)))"
116-
} else if #available(_mangledTypeNameAPI, *), isSwiftEnumeration(valueType) {
116+
} else if #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *), isSwiftEnumeration(valueType) {
117117
// Add a leading period to enumeration cases to more closely match their
118118
// source representation. SEE: _adHocPrint_unlocked() in the stdlib.
119119
self = ".\(value)"

Sources/Testing/Support/Additions/TypeAdditions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func nameComponents(of type: Any.Type) -> [String] {
3434
/// - Bug: We use the internal Swift standard library function
3535
/// `_mangledTypeName()` to derive this information. We should use supported
3636
/// API instead. ([swift-#69147](https://github.com/apple/swift/issues/69147))
37-
@available(_mangledTypeNameAPI, *)
37+
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
3838
func isSwiftEnumeration(_ type: Any.Type) -> Bool {
3939
guard let mangledTypeName = _mangledTypeName(type), let lastCharacter = mangledTypeName.last else {
4040
return false
@@ -58,7 +58,7 @@ func isSwiftEnumeration(_ type: Any.Type) -> Bool {
5858
/// - Bug: We use the internal Swift standard library function
5959
/// `_mangledTypeName()` to derive this information. We should use supported
6060
/// API instead. ([swift-#69146](https://github.com/apple/swift/issues/69146))
61-
@available(_mangledTypeNameAPI, *)
61+
@available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)
6262
func isImportedFromC(_ type: Any.Type) -> Bool {
6363
guard let mangledTypeName = _mangledTypeName(type), mangledTypeName.count > 2 else {
6464
return false

Sources/Testing/Support/Versions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ var testingLibraryVersion: String {
142142
///
143143
/// This value is not part of the public interface of the testing library.
144144
let swiftStandardLibraryVersion: String = {
145-
if #available(_swiftVersionAPI, *) {
145+
if #available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) {
146146
return String(describing: _SwiftStdlibVersion.current)
147147
}
148148
return "unknown"

Sources/Testing/Testing.docc/TemporaryGettingStarted.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ In your package's Package.swift file, add the testing library as a dependency:
4141

4242
```swift
4343
dependencies: [
44-
.package(url: "https://github.com/apple/swift-testing.git", branch: "main"),
44+
.package(url: "https://github.com/apple/swift-testing.git", from: "0.2.0"),
4545
],
4646
```
4747

Sources/Testing/Traits/TimeLimitTrait.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
/// To add this trait to a test, use one of the following functions:
1414
///
1515
/// - ``Trait/timeLimit(_:)``
16-
@available(_clockAPI, *)
16+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
1717
public struct TimeLimitTrait: TestTrait, SuiteTrait {
1818
/// The maximum amount of time a test may run for before timing out.
1919
public var timeLimit: Duration
@@ -29,7 +29,7 @@ public struct TimeLimitTrait: TestTrait, SuiteTrait {
2929

3030
// MARK: -
3131

32-
@available(_clockAPI, *)
32+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
3333
extension Trait where Self == TimeLimitTrait {
3434
/// Construct a time limit trait that causes a test to time out if it runs for
3535
/// too long.
@@ -55,7 +55,7 @@ extension Trait where Self == TimeLimitTrait {
5555

5656
// MARK: -
5757

58-
@available(_clockAPI, *)
58+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
5959
extension Test {
6060
/// The maximum amount of time the cases of this test may run for.
6161
///
@@ -123,7 +123,7 @@ extension Test {
123123
/// and `body` is cancelled.
124124
///
125125
/// This function is not part of the public interface of the testing library.
126-
@available(_clockAPI, *)
126+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
127127
func withTimeLimit(
128128
_ timeLimit: Duration,
129129
_ body: @escaping @Sendable () async throws -> Void,
@@ -170,7 +170,7 @@ func withTimeLimit(
170170
_ body: @escaping @Sendable () async throws -> Void,
171171
timeoutHandler: @escaping @Sendable (_ timeLimit: (seconds: Int64, attoseconds: Int64)) -> Void
172172
) async throws {
173-
if #available(_clockAPI, *),
173+
if #available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *),
174174
let timeLimit = test.adjustedTimeLimit(configuration: configuration) {
175175
#if SWT_NO_UNSTRUCTURED_TASKS
176176
// This environment may not support full concurrency, so check if the body

Tests/TestingTests/ClockTests.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private import TestingInternals
1616

1717
@Suite("Clock API Tests")
1818
struct ClockTests {
19-
@available(_clockAPI, *)
19+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
2020
@Test("Clock.Instant basics")
2121
func clockInstant() async throws {
2222
let instant1 = Test.Clock.Instant.now
@@ -46,7 +46,7 @@ struct ClockTests {
4646
#endif
4747
}
4848

49-
@available(_clockAPI, *)
49+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
5050
@Test("Creating a SuspendingClock.Instant from Test.Clock.Instant")
5151
func suspendingInstantInitializer() async throws {
5252
let instant1 = SuspendingClock.Instant(Test.Clock.Instant.now)
@@ -56,7 +56,7 @@ struct ClockTests {
5656
#expect(instant1 < instant2)
5757
}
5858

59-
@available(_clockAPI, *)
59+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
6060
@Test("Clock.sleep(until:tolerance:) method")
6161
func sleepUntilTolerance() async throws {
6262
let instant1 = SuspendingClock.Instant(Test.Clock.Instant.now)
@@ -67,7 +67,7 @@ struct ClockTests {
6767
}
6868

6969
#if !SWT_NO_UTC_CLOCK
70-
@available(_clockAPI, *)
70+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
7171
@Test("Clock.Instant.timeComponentsSince1970 property")
7272
func timeComponentsSince1970() async throws {
7373
let instant1 = Test.Clock.Instant.now.timeComponentsSince1970
@@ -79,7 +79,7 @@ struct ClockTests {
7979
#endif
8080

8181
#if !SWT_NO_UTC_CLOCK
82-
@available(_clockAPI, *)
82+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
8383
@Test("Clock.Instant.durationSince1970 property")
8484
func durationSince1970() async throws {
8585
let instant1 = Test.Clock.Instant.now.durationSince1970
@@ -90,7 +90,7 @@ struct ClockTests {
9090
}
9191
#endif
9292

93-
@available(_clockAPI, *)
93+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
9494
@Test("Clock.now property")
9595
func clockNowProperty() async throws {
9696
let instant1 = Test.Clock().now
@@ -100,14 +100,14 @@ struct ClockTests {
100100
#expect(instant1 < instant2)
101101
}
102102

103-
@available(_clockAPI, *)
103+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
104104
@Test("Clock.minimumResolution property")
105105
func clockMinimumResolutionProperty() async throws {
106106
let minimumResolution = Test.Clock().minimumResolution
107107
#expect(minimumResolution == SuspendingClock().minimumResolution)
108108
}
109109

110-
@available(_clockAPI, *)
110+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
111111
@Test("Clock.Instant.advanced(by:) and .duration(to:) methods")
112112
func instantAdvancedByAndDurationTo() async throws {
113113
let offsetNanoseconds = Int64.random(in: -1_000_000_000 ..< 1_000_000_000)
@@ -124,7 +124,7 @@ struct ClockTests {
124124
}
125125

126126
#if canImport(Foundation)
127-
@available(_clockAPI, *)
127+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
128128
@Test("Codable")
129129
func codable() async throws {
130130
let now = Test.Clock.Instant()
@@ -137,7 +137,7 @@ struct ClockTests {
137137
}
138138
#endif
139139

140-
@available(_clockAPI, *)
140+
@available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
141141
@Test("Clock.Instant.nanoseconds(until:) method",
142142
arguments: [
143143
(Duration.zero, 0),

Tests/TestingTests/EventRecorderTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct EventRecorderTests {
9090
}
9191

9292
#if !os(Windows)
93-
@available(_regexAPI, *)
93+
@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)
9494
@Test(
9595
"Issue counts are summed correctly on test end",
9696
arguments: [
@@ -140,7 +140,7 @@ struct EventRecorderTests {
140140
}
141141
#endif
142142

143-
@available(_regexAPI, *)
143+
@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)
144144
@Test("Issue counts are omitted on a successful test")
145145
func issueCountOmittedForPassingTest() async throws {
146146
let stream = Stream()
@@ -163,7 +163,7 @@ struct EventRecorderTests {
163163
}
164164

165165
#if !os(Windows)
166-
@available(_regexAPI, *)
166+
@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *)
167167
@Test("Issue counts are summed correctly on run end")
168168
func issueCountSummingAtRunEnd() async throws {
169169
let stream = Stream()

Tests/TestingTests/IssueTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ final class IssueTests: XCTestCase {
11411141
}
11421142

11431143
func testEnumDescription() async throws {
1144-
guard #available(_mangledTypeNameAPI, *) else {
1144+
guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) else {
11451145
throw XCTSkip("Unavailable")
11461146
}
11471147

@@ -1204,7 +1204,7 @@ final class IssueTests: XCTestCase {
12041204
}
12051205

12061206
func testCEnumDescription() async throws {
1207-
guard #available(_mangledTypeNameAPI, *) else {
1207+
guard #available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *) else {
12081208
throw XCTSkip("Unavailable")
12091209
}
12101210

0 commit comments

Comments
 (0)