From 6e4fe1f913fd6b287c247cb2a8e164fd2435920e Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Sat, 3 May 2025 08:07:12 -0500 Subject: [PATCH 1/4] Restore DocC `@Comment` blocks to documentation line comments (#1103) --- Sources/Testing/Attachments/Attachment.swift | 10 ++-- Sources/Testing/Issues/Issue.swift | 24 ++++----- .../Test.Case.Generator.swift | 30 +++++------ .../Testing/Support/CartesianProduct.swift | 20 ++++---- Sources/Testing/Test+Macro.swift | 50 +++++++++---------- Sources/Testing/Traits/ConditionTrait.swift | 24 ++++----- .../TestSupport/TestingAdditions.swift | 20 ++++---- 7 files changed, 89 insertions(+), 89 deletions(-) diff --git a/Sources/Testing/Attachments/Attachment.swift b/Sources/Testing/Attachments/Attachment.swift index 7468834bf..366e288d1 100644 --- a/Sources/Testing/Attachments/Attachment.swift +++ b/Sources/Testing/Attachments/Attachment.swift @@ -131,11 +131,11 @@ extension Attachment where AttachableValue == AnyAttachable { /// events of kind ``Event/Kind/valueAttached(_:)``. Test tools authors who use /// `@_spi(ForToolsIntegrationOnly)` will see instances of this type when /// handling those events. -// -// @Comment { -// Swift's type system requires that this type be at least as visible as -// `Event.Kind.valueAttached(_:)`, otherwise it would be declared private. -// } +/// +/// @Comment { +/// Swift's type system requires that this type be at least as visible as +/// `Event.Kind.valueAttached(_:)`, otherwise it would be declared private. +/// } @_spi(ForToolsIntegrationOnly) public struct AnyAttachable: AttachableWrapper, Copyable, Sendable { #if !SWT_NO_LAZY_ATTACHMENTS diff --git a/Sources/Testing/Issues/Issue.swift b/Sources/Testing/Issues/Issue.swift index 4a17cb945..9a2555177 100644 --- a/Sources/Testing/Issues/Issue.swift +++ b/Sources/Testing/Issues/Issue.swift @@ -49,12 +49,12 @@ public struct Issue: Sendable { /// /// - Parameters: /// - timeLimitComponents: The time limit reached by the test. - // - // @Comment { - // - Bug: The associated value of this enumeration case should be an - // instance of `Duration`, but the testing library's deployment target - // predates the introduction of that type. - // } + /// + /// @Comment { + /// - Bug: The associated value of this enumeration case should be an + /// instance of `Duration`, but the testing library's deployment target + /// predates the introduction of that type. + /// } indirect case timeLimitExceeded(timeLimitComponents: (seconds: Int64, attoseconds: Int64)) /// A known issue was expected, but was not recorded. @@ -434,12 +434,12 @@ extension Issue.Kind { /// /// - Parameters: /// - timeLimitComponents: The time limit reached by the test. - // - // @Comment { - // - Bug: The associated value of this enumeration case should be an - // instance of `Duration`, but the testing library's deployment target - // predates the introduction of that type. - // } + /// + /// @Comment { + /// - Bug: The associated value of this enumeration case should be an + /// instance of `Duration`, but the testing library's deployment target + /// predates the introduction of that type. + /// } indirect case timeLimitExceeded(timeLimitComponents: (seconds: Int64, attoseconds: Int64)) /// A known issue was expected, but was not recorded. diff --git a/Sources/Testing/Parameterization/Test.Case.Generator.swift b/Sources/Testing/Parameterization/Test.Case.Generator.swift index d30e3a7d3..05467d9bd 100644 --- a/Sources/Testing/Parameterization/Test.Case.Generator.swift +++ b/Sources/Testing/Parameterization/Test.Case.Generator.swift @@ -13,11 +13,11 @@ extension Test.Case { /// a known collection of argument values. /// /// Instances of this type can be iterated over multiple times. - // - // @Comment { - // - Bug: The testing library should support variadic generics. - // ([103416861](rdar://103416861)) - // } + /// + /// @Comment { + /// - Bug: The testing library should support variadic generics. + /// ([103416861](rdar://103416861)) + /// } struct Generator: Sendable where S: Sequence & Sendable, S.Element: Sendable { /// The underlying sequence of argument values. /// @@ -146,11 +146,11 @@ extension Test.Case { /// /// This initializer overload is specialized for sequences of 2-tuples to /// efficiently de-structure their elements when appropriate. - // - // @Comment { - // - Bug: The testing library should support variadic generics. - // ([103416861](rdar://103416861)) - // } + /// + /// @Comment { + /// - Bug: The testing library should support variadic generics. + /// ([103416861](rdar://103416861)) + /// } private init( sequence: S, parameters: [Test.Parameter], @@ -184,11 +184,11 @@ extension Test.Case { /// /// This initializer overload is specialized for collections of 2-tuples to /// efficiently de-structure their elements when appropriate. - // - // @Comment { - // - Bug: The testing library should support variadic generics. - // ([103416861](rdar://103416861)) - // } + /// + /// @Comment { + /// - Bug: The testing library should support variadic generics. + /// ([103416861](rdar://103416861)) + /// } init( arguments collection: S, parameters: [Test.Parameter], diff --git a/Sources/Testing/Support/CartesianProduct.swift b/Sources/Testing/Support/CartesianProduct.swift index 07b164eb5..43d92e462 100644 --- a/Sources/Testing/Support/CartesianProduct.swift +++ b/Sources/Testing/Support/CartesianProduct.swift @@ -17,11 +17,11 @@ /// `[(1, "a"), (1, "b"), (1, "c"), (2, "a"), (2, "b"), ... (3, "c")]`. /// /// This type is not part of the public interface of the testing library. -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } +/// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } struct CartesianProduct: LazySequenceProtocol where C1: Collection, C2: Collection { fileprivate var collection1: C1 fileprivate var collection2: C2 @@ -63,11 +63,11 @@ extension CartesianProduct: Sendable where C1: Sendable, C2: Sendable {} /// while `collection2` is iterated `collection1.count` times. /// /// For more information on Cartesian products, see ``CartesianProduct``. -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } +/// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } func cartesianProduct(_ collection1: C1, _ collection2: C2) -> CartesianProduct where C1: Collection, C2: Collection { CartesianProduct(collection1: collection1, collection2: collection2) } diff --git a/Sources/Testing/Test+Macro.swift b/Sources/Testing/Test+Macro.swift index d1ad6623b..be0b5a91b 100644 --- a/Sources/Testing/Test+Macro.swift +++ b/Sources/Testing/Test+Macro.swift @@ -220,14 +220,14 @@ public macro Test( /// During testing, the associated test function is called once for each element /// in `collection`. /// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } +/// /// ## See Also /// /// - -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } @attached(peer) public macro Test( _ displayName: _const String? = nil, _ traits: any TestTrait..., @@ -273,14 +273,14 @@ extension Test { /// During testing, the associated test function is called once for each pair of /// elements in `collection1` and `collection2`. /// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } +/// /// ## See Also /// /// - -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } @attached(peer) @_documentation(visibility: private) public macro Test( @@ -301,14 +301,14 @@ public macro Test( /// During testing, the associated test function is called once for each pair of /// elements in `collection1` and `collection2`. /// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } +/// /// ## See Also /// /// - -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } @attached(peer) public macro Test( _ displayName: _const String? = nil, _ traits: any TestTrait..., @@ -327,14 +327,14 @@ public macro Test( /// During testing, the associated test function is called once for each element /// in `zippedCollections`. /// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } +/// /// ## See Also /// /// - -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } @attached(peer) @_documentation(visibility: private) public macro Test( @@ -355,14 +355,14 @@ public macro Test( /// During testing, the associated test function is called once for each element /// in `zippedCollections`. /// +/// @Comment { +/// - Bug: The testing library should support variadic generics. +/// ([103416861](rdar://103416861)) +/// } +/// /// ## See Also /// /// - -// -// @Comment { -// - Bug: The testing library should support variadic generics. -// ([103416861](rdar://103416861)) -// } @attached(peer) public macro Test( _ displayName: _const String? = nil, _ traits: any TestTrait..., diff --git a/Sources/Testing/Traits/ConditionTrait.swift b/Sources/Testing/Traits/ConditionTrait.swift index eb3d1bd11..079b64d8e 100644 --- a/Sources/Testing/Traits/ConditionTrait.swift +++ b/Sources/Testing/Traits/ConditionTrait.swift @@ -115,12 +115,12 @@ extension Trait where Self == ConditionTrait { /// /// - Returns: An instance of ``ConditionTrait`` that evaluates the /// closure you provide. - // - // @Comment { - // - Bug: `condition` cannot be `async` without making this function - // `async` even though `condition` is not evaluated locally. - // ([103037177](rdar://103037177)) - // } + /// + /// @Comment { + /// - Bug: `condition` cannot be `async` without making this function + /// `async` even though `condition` is not evaluated locally. + /// ([103037177](rdar://103037177)) + /// } public static func enabled( if condition: @autoclosure @escaping @Sendable () throws -> Bool, _ comment: Comment? = nil, @@ -174,12 +174,12 @@ extension Trait where Self == ConditionTrait { /// /// - Returns: An instance of ``ConditionTrait`` that evaluates the /// closure you provide. - // - // @Comment { - // - Bug: `condition` cannot be `async` without making this function - // `async` even though `condition` is not evaluated locally. - // ([103037177](rdar://103037177)) - // } + /// + /// @Comment { + /// - Bug: `condition` cannot be `async` without making this function + /// `async` even though `condition` is not evaluated locally. + /// ([103037177](rdar://103037177)) + /// } public static func disabled( if condition: @autoclosure @escaping @Sendable () throws -> Bool, _ comment: Comment? = nil, diff --git a/Tests/TestingTests/TestSupport/TestingAdditions.swift b/Tests/TestingTests/TestSupport/TestingAdditions.swift index 6807fd62a..4648f96af 100644 --- a/Tests/TestingTests/TestSupport/TestingAdditions.swift +++ b/Tests/TestingTests/TestSupport/TestingAdditions.swift @@ -162,11 +162,11 @@ extension Test { /// - testFunction: The function to call when running this test. During /// testing, this function is called once for each element in /// `collection`. - // - // @Comment { - // - Bug: The testing library should support variadic generics. - // ([103416861](rdar://103416861)) - // } + /// + /// @Comment { + /// - Bug: The testing library should support variadic generics. + /// ([103416861](rdar://103416861)) + /// } init( _ traits: any TestTrait..., arguments collection: C, @@ -191,11 +191,11 @@ extension Test { /// - testFunction: The function to call when running this test. During /// testing, this function is called once for each pair of elements in /// `collection1` and `collection2`. - // - // @Comment { - // - Bug: The testing library should support variadic generics. - // ([103416861](rdar://103416861)) - // } + /// + /// @Comment { + /// - Bug: The testing library should support variadic generics. + /// ([103416861](rdar://103416861)) + /// } init( _ traits: any TestTrait..., arguments collection1: C1, _ collection2: C2, From 91f7889dcb4f8215832d9af813f71f48d73ee4b7 Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Tue, 6 May 2025 19:55:42 -0700 Subject: [PATCH 2/4] Work around compiler bug affecting macro decls with #if-guarded availability when building w/legacy driver (#1106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This works around a Swift compiler bug which causes a failure validating the generated .swiftinterface of the `Testing` module due to it having macro declarations with `#if`-conditionalized `@available(...)` attributes _before_ any other `@`-attributes. The PR which recently landed to enable the Exit Tests feature (#324) revealed this compiler bug — specifically, that PR removed `@_spi` attributes which until then _preceded_ `#if SWT_NO_EXIT_TESTS`. The workaround is to move other attributes on the affected macro declarations up before the `#if`. The compiler bug is being fixed in https://github.com/swiftlang/swift/pull/81346. It only appears to happen when building with the legacy driver, and Android uses that driver still. An example CI failure log can be found here: > https://github.com/thebrowsercompany/swift-build/actions/runs/14823859186/job/41615678071#step:32:72 ### 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. --- Sources/Testing/Expectations/Expectation+Macro.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/Testing/Expectations/Expectation+Macro.swift b/Sources/Testing/Expectations/Expectation+Macro.swift index d14920547..f85c7042b 100644 --- a/Sources/Testing/Expectations/Expectation+Macro.swift +++ b/Sources/Testing/Expectations/Expectation+Macro.swift @@ -514,11 +514,12 @@ public macro require( /// @Metadata { /// @Available(Swift, introduced: 6.2) /// } +@freestanding(expression) +@discardableResult #if SWT_NO_EXIT_TESTS @available(*, unavailable, message: "Exit tests are not available on this platform.") #endif -@discardableResult -@freestanding(expression) public macro expect( +public macro expect( processExitsWith expectedExitCondition: ExitTest.Condition, observing observedValues: [any PartialKeyPath & Sendable] = [], _ comment: @autoclosure () -> Comment? = nil, @@ -559,11 +560,12 @@ public macro require( /// @Metadata { /// @Available(Swift, introduced: 6.2) /// } +@freestanding(expression) +@discardableResult #if SWT_NO_EXIT_TESTS @available(*, unavailable, message: "Exit tests are not available on this platform.") #endif -@discardableResult -@freestanding(expression) public macro require( +public macro require( processExitsWith expectedExitCondition: ExitTest.Condition, observing observedValues: [any PartialKeyPath & Sendable] = [], _ comment: @autoclosure () -> Comment? = nil, From 3ad851e7a4ea978ed1010b05d8e3c7dc0f5349ae Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Wed, 7 May 2025 12:53:21 -0700 Subject: [PATCH 3/4] Simplify usages of withTaskGroup to infer ChildTaskResult type where possible (#1102) This adjusts usages of `withTaskGroup` and `withThrowingTaskGroup` to take advantage of [SE-0442: Allow TaskGroup's ChildTaskResult Type To Be Inferred](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0442-allow-taskgroup-childtaskresult-type-to-be-inferred.md) by inferring the child task result type. I successfully built this PR using a Swift 6.1 toolchain. A couple usages I _did_ need to leave explicitly specified, but most I was able to simplify. ### 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. --- Sources/Testing/Running/Runner.swift | 4 ++-- Sources/Testing/Test+Discovery.swift | 4 ++-- Sources/Testing/Traits/TimeLimitTrait.swift | 2 +- Tests/TestingTests/Support/CartesianProductTests.swift | 2 +- Tests/TestingTests/Support/LockTests.swift | 2 +- Tests/TestingTests/Traits/TimeLimitTraitTests.swift | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/Testing/Running/Runner.swift b/Sources/Testing/Running/Runner.swift index 8520d1aaf..bd1167b8e 100644 --- a/Sources/Testing/Running/Runner.swift +++ b/Sources/Testing/Running/Runner.swift @@ -156,7 +156,7 @@ extension Runner { in sequence: some Sequence, _ body: @Sendable @escaping (E) async throws -> Void ) async throws where E: Sendable { - try await withThrowingTaskGroup(of: Void.self) { taskGroup in + try await withThrowingTaskGroup { taskGroup in for element in sequence { // Each element gets its own subtask to run in. _ = taskGroup.addTaskUnlessCancelled { @@ -430,7 +430,7 @@ extension Runner { Event.post(.iterationEnded(iterationIndex), for: (nil, nil), configuration: runner.configuration) } - await withTaskGroup(of: Void.self) { [runner] taskGroup in + await withTaskGroup { [runner] taskGroup in _ = taskGroup.addTaskUnlessCancelled { try? await _runStep(atRootOf: runner.plan.stepGraph) } diff --git a/Sources/Testing/Test+Discovery.swift b/Sources/Testing/Test+Discovery.swift index 35f716525..5e9632d70 100644 --- a/Sources/Testing/Test+Discovery.swift +++ b/Sources/Testing/Test+Discovery.swift @@ -84,7 +84,7 @@ extension Test { // a task group and collate their results. if useNewMode { let generators = Generator.allTestContentRecords().lazy.compactMap { $0.load() } - await withTaskGroup(of: Self.self) { taskGroup in + await withTaskGroup { taskGroup in for generator in generators { taskGroup.addTask { await generator.rawValue() } } @@ -96,7 +96,7 @@ extension Test { // Perform legacy test discovery if needed. if useLegacyMode && result.isEmpty { let generators = Generator.allTypeMetadataBasedTestContentRecords().lazy.compactMap { $0.load() } - await withTaskGroup(of: Self.self) { taskGroup in + await withTaskGroup { taskGroup in for generator in generators { taskGroup.addTask { await generator.rawValue() } } diff --git a/Sources/Testing/Traits/TimeLimitTrait.swift b/Sources/Testing/Traits/TimeLimitTrait.swift index 4e84a1f92..54a200fb4 100644 --- a/Sources/Testing/Traits/TimeLimitTrait.swift +++ b/Sources/Testing/Traits/TimeLimitTrait.swift @@ -264,7 +264,7 @@ func withTimeLimit( _ body: @escaping @Sendable () async throws -> Void, timeoutHandler: @escaping @Sendable () -> Void ) async throws { - try await withThrowingTaskGroup(of: Void.self) { group in + try await withThrowingTaskGroup { group in group.addTask { // If sleep() returns instead of throwing a CancellationError, that means // the timeout was reached before this task could be cancelled, so call diff --git a/Tests/TestingTests/Support/CartesianProductTests.swift b/Tests/TestingTests/Support/CartesianProductTests.swift index b817b37f6..3cb4f6daf 100644 --- a/Tests/TestingTests/Support/CartesianProductTests.swift +++ b/Tests/TestingTests/Support/CartesianProductTests.swift @@ -96,7 +96,7 @@ struct CartesianProductTests { // Test that the product can be iterated multiple times concurrently. let (_, _, product) = computeCartesianProduct() let expectedSum = product.reduce(into: 0) { $0 &+= $1.1 } - await withTaskGroup(of: Int.self) { taskGroup in + await withTaskGroup { taskGroup in for _ in 0 ..< 10 { taskGroup.addTask { product.reduce(into: 0) { $0 &+= $1.1 } diff --git a/Tests/TestingTests/Support/LockTests.swift b/Tests/TestingTests/Support/LockTests.swift index 0113745e9..2a41e4c1d 100644 --- a/Tests/TestingTests/Support/LockTests.swift +++ b/Tests/TestingTests/Support/LockTests.swift @@ -36,7 +36,7 @@ struct LockTests { @Test("No lock") func noLock() async { let lock = LockedWith(rawValue: 0) - await withTaskGroup(of: Void.self) { taskGroup in + await withTaskGroup { taskGroup in for _ in 0 ..< 100_000 { taskGroup.addTask { lock.increment() diff --git a/Tests/TestingTests/Traits/TimeLimitTraitTests.swift b/Tests/TestingTests/Traits/TimeLimitTraitTests.swift index b29ccb93c..49412b6af 100644 --- a/Tests/TestingTests/Traits/TimeLimitTraitTests.swift +++ b/Tests/TestingTests/Traits/TimeLimitTraitTests.swift @@ -181,7 +181,7 @@ struct TimeLimitTraitTests { @Test("Cancelled tests can exit early (cancellation checking works)") func cancelledTestExitsEarly() async throws { let timeAwaited = await Test.Clock().measure { - await withTaskGroup(of: Void.self) { taskGroup in + await withTaskGroup { taskGroup in taskGroup.addTask { await Test { try await Test.Clock.sleep(for: .seconds(60) * 60) From 1932a1b4c0899987ea85a80c01b446de39f54737 Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Wed, 7 May 2025 15:37:57 -0700 Subject: [PATCH 4/4] Add missing Foundation imports to fix test build errors on iOS with MemberImportVisibility enabled (#1108) This fixes several instances of a build error when attempting to build this package for iOS, or any non-macOS Apple platform. Here's one example ``` error: instance method 'contains' is not available due to missing import of defining module 'Foundation' Tests/TestingTests/SwiftPMTests.swift:370:5: note: in expansion of macro 'expect' here #expect(testIDs.allSatisfy { $0.contains(".swift:") }) ``` This general kind of build error is being emitted because we adopted [SE-0444: Member import visibility](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md) by enabling the `MemberImportVisibility` experimental feature in #1020. In that PR, I fixed several instances of missing imports, including some for `Foundation` in test files. But these errors are from usages of `String.contains()`, and it turns out there are multiple overloads of that function, with an older one in `Foundation` and a newer one directly in the stdlib `Swift` module. The latter has newer, iOS 13.0-aligned API availability, and when building our tests for macOS this issue was not noticed previously because SwiftPM artificially raises the deployment target of macOS test targets to match the testing frameworks included in Xcode (when the testing libraries are being used from the installed copy of Xcode). ### 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. --- Tests/TestingTests/ConfirmationTests.swift | 4 ++++ Tests/TestingTests/MiscellaneousTests.swift | 4 ++++ Tests/TestingTests/SwiftPMTests.swift | 4 ++++ Tests/TestingTests/Traits/TagListTests.swift | 4 ++++ Tests/TestingTests/Traits/TimeLimitTraitTests.swift | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/Tests/TestingTests/ConfirmationTests.swift b/Tests/TestingTests/ConfirmationTests.swift index c4f076268..2551513eb 100644 --- a/Tests/TestingTests/ConfirmationTests.swift +++ b/Tests/TestingTests/ConfirmationTests.swift @@ -10,6 +10,10 @@ @testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing +#if canImport(Foundation) +private import Foundation +#endif + @Suite("Confirmation Tests") struct ConfirmationTests { @Test("Successful confirmations") diff --git a/Tests/TestingTests/MiscellaneousTests.swift b/Tests/TestingTests/MiscellaneousTests.swift index b4b12a217..9ae326afe 100644 --- a/Tests/TestingTests/MiscellaneousTests.swift +++ b/Tests/TestingTests/MiscellaneousTests.swift @@ -12,6 +12,10 @@ @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import _TestDiscovery private import _TestingInternals +#if canImport(Foundation) +private import Foundation +#endif + @Test(/* name unspecified */ .hidden) @Sendable func freeSyncFunction() {} @Sendable func freeAsyncFunction() async {} diff --git a/Tests/TestingTests/SwiftPMTests.swift b/Tests/TestingTests/SwiftPMTests.swift index 6e7be0f15..eadde29a7 100644 --- a/Tests/TestingTests/SwiftPMTests.swift +++ b/Tests/TestingTests/SwiftPMTests.swift @@ -11,6 +11,10 @@ @testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing private import _TestingInternals +#if canImport(Foundation) +private import Foundation +#endif + private func configurationForEntryPoint(withArguments args: [String]) throws -> Configuration { let args = try parseCommandLineArguments(from: args) return try configurationForEntryPoint(from: args) diff --git a/Tests/TestingTests/Traits/TagListTests.swift b/Tests/TestingTests/Traits/TagListTests.swift index 1ec8d1248..81cba285c 100644 --- a/Tests/TestingTests/Traits/TagListTests.swift +++ b/Tests/TestingTests/Traits/TagListTests.swift @@ -11,6 +11,10 @@ @testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing private import _TestingInternals +#if canImport(Foundation) +private import Foundation +#endif + @Suite("Tag/Tag List Tests", .tags(.traitRelated)) struct TagListTests { @Test(".tags() factory method with one tag") diff --git a/Tests/TestingTests/Traits/TimeLimitTraitTests.swift b/Tests/TestingTests/Traits/TimeLimitTraitTests.swift index 49412b6af..7d427f259 100644 --- a/Tests/TestingTests/Traits/TimeLimitTraitTests.swift +++ b/Tests/TestingTests/Traits/TimeLimitTraitTests.swift @@ -10,6 +10,10 @@ @testable @_spi(Experimental) @_spi(ForToolsIntegrationOnly) import Testing +#if canImport(Foundation) +private import Foundation +#endif + @Suite("TimeLimitTrait Tests", .tags(.traitRelated)) struct TimeLimitTraitTests { @available(_clockAPI, *)