From 2c0be28493109dd1af46affc2f3f22e1ee99b98b Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Sun, 26 Jan 2025 11:48:54 -0600 Subject: [PATCH 1/2] Declare Swift 6.1 availability for TestScoping-related APIs --- Sources/Testing/Traits/Trait.swift | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Sources/Testing/Traits/Trait.swift b/Sources/Testing/Traits/Trait.swift index 4c942f52a..b08200cf3 100644 --- a/Sources/Testing/Traits/Trait.swift +++ b/Sources/Testing/Traits/Trait.swift @@ -48,6 +48,10 @@ public protocol Trait: Sendable { /// ``scopeProvider(for:testCase:)-cjmg`` method for any trait with this /// default type must return `nil`, meaning that trait will not provide a /// custom scope for the tests it's applied to. + /// + /// @Metadata { + /// @Available(Swift, introduced: 6.1) + /// } associatedtype TestScopeProvider: TestScoping = Never /// Get this trait's scope provider for the specified test and/or test case, @@ -93,6 +97,10 @@ public protocol Trait: Sendable { /// associated ``Trait/TestScopeProvider`` type is the default `Never`, then /// this method returns `nil` by default. This means that instances of this /// trait will not provide a custom scope for tests to which they're applied. + /// + /// @Metadata { + /// @Available(Swift, introduced: 6.1) + /// } func scopeProvider(for test: Test, testCase: Test.Case?) -> TestScopeProvider? } @@ -107,6 +115,10 @@ public protocol Trait: Sendable { /// logic for tests which have similar needs allows each test function to be /// more succinct with less repetitive boilerplate so it can focus on what makes /// it unique. +/// +/// @Metadata { +/// @Available(Swift, introduced: 6.1) +/// } public protocol TestScoping: Sendable { /// Provide custom execution scope for a function call which is related to the /// specified test and/or test case. @@ -140,6 +152,10 @@ public protocol TestScoping: Sendable { /// an error if it is unable to provide a custom scope. /// /// Issues recorded by this method are associated with `test`. + /// + /// @Metadata { + /// @Available(Swift, introduced: 6.1) + /// } func provideScope(for test: Test, testCase: Test.Case?, performing function: @Sendable () async throws -> Void) async throws } @@ -156,6 +172,10 @@ extension Trait where Self: TestScoping { /// This default implementation is used when this trait type conforms to /// ``TestScoping`` and its return value is discussed in /// ``Trait/scopeProvider(for:testCase:)-cjmg``. + /// + /// @Metadata { + /// @Available(Swift, introduced: 6.1) + /// } public func scopeProvider(for test: Test, testCase: Test.Case?) -> Self? { testCase == nil ? nil : self } @@ -174,6 +194,10 @@ extension SuiteTrait where Self: TestScoping { /// This default implementation is used when this trait type conforms to /// ``TestScoping`` and its return value is discussed in /// ``Trait/scopeProvider(for:testCase:)-cjmg``. + /// + /// @Metadata { + /// @Available(Swift, introduced: 6.1) + /// } public func scopeProvider(for test: Test, testCase: Test.Case?) -> Self? { if test.isSuite { isRecursive ? nil : self @@ -229,6 +253,10 @@ extension Trait where TestScopeProvider == Never { /// This default implementation is used when this trait type's associated /// ``Trait/TestScopeProvider`` type is the default value of `Never`, and its /// return value is discussed in ``Trait/scopeProvider(for:testCase:)-cjmg``. + /// + /// @Metadata { + /// @Available(Swift, introduced: 6.1) + /// } public func scopeProvider(for test: Test, testCase: Test.Case?) -> Never? { nil } From 13b41edf6251d4ad02aa48b2d9cea06d16722dba Mon Sep 17 00:00:00 2001 From: Stuart Montgomery Date: Mon, 27 Jan 2025 11:28:04 -0600 Subject: [PATCH 2/2] Use DocC extension files for now, since the systems which currently render documentation won't be able to upgrade DocC until the next Swift release --- ...opeProvider-default-implementation-Self.md | 15 ++++++++++ .../Traits/TestScopeProvider.md | 15 ++++++++++ .../Traits/TestScoping-provideScope.md | 15 ++++++++++ .../AvailabilityStubs/Traits/TestScoping.md | 15 ++++++++++ ...peProvider-default-implementation-Never.md | 15 ++++++++++ ...opeProvider-default-implementation-Self.md | 15 ++++++++++ ...rait-scopeProvider-protocol-requirement.md | 15 ++++++++++ Sources/Testing/Traits/Trait.swift | 28 ------------------- 8 files changed, 105 insertions(+), 28 deletions(-) create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/SuiteTrait-scopeProvider-default-implementation-Self.md create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScopeProvider.md create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping-provideScope.md create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping.md create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Never.md create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Self.md create mode 100644 Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-protocol-requirement.md diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/SuiteTrait-scopeProvider-default-implementation-Self.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/SuiteTrait-scopeProvider-default-implementation-Self.md new file mode 100644 index 000000000..6136ee8cb --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/SuiteTrait-scopeProvider-default-implementation-Self.md @@ -0,0 +1,15 @@ +# ``Trait/scopeProvider(for:testCase:)-1z8kh`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScopeProvider.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScopeProvider.md new file mode 100644 index 000000000..25281bfe6 --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScopeProvider.md @@ -0,0 +1,15 @@ +# ``Trait/TestScopeProvider`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping-provideScope.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping-provideScope.md new file mode 100644 index 000000000..809fb833e --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping-provideScope.md @@ -0,0 +1,15 @@ +# ``TestScoping/provideScope(for:testCase:performing:)`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping.md new file mode 100644 index 000000000..a0ab00e1f --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/TestScoping.md @@ -0,0 +1,15 @@ +# ``TestScoping`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Never.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Never.md new file mode 100644 index 000000000..8e903eb3b --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Never.md @@ -0,0 +1,15 @@ +# ``Trait/scopeProvider(for:testCase:)-9fxg4`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Self.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Self.md new file mode 100644 index 000000000..0ff33a204 --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-default-implementation-Self.md @@ -0,0 +1,15 @@ +# ``Trait/scopeProvider(for:testCase:)-inmj`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-protocol-requirement.md b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-protocol-requirement.md new file mode 100644 index 000000000..5fcff2667 --- /dev/null +++ b/Sources/Testing/Testing.docc/AvailabilityStubs/Traits/Trait-scopeProvider-protocol-requirement.md @@ -0,0 +1,15 @@ +# ``Trait/scopeProvider(for:testCase:)`` + + + +@Metadata { + @Available(Swift, introduced: 6.1) +} diff --git a/Sources/Testing/Traits/Trait.swift b/Sources/Testing/Traits/Trait.swift index b08200cf3..4c942f52a 100644 --- a/Sources/Testing/Traits/Trait.swift +++ b/Sources/Testing/Traits/Trait.swift @@ -48,10 +48,6 @@ public protocol Trait: Sendable { /// ``scopeProvider(for:testCase:)-cjmg`` method for any trait with this /// default type must return `nil`, meaning that trait will not provide a /// custom scope for the tests it's applied to. - /// - /// @Metadata { - /// @Available(Swift, introduced: 6.1) - /// } associatedtype TestScopeProvider: TestScoping = Never /// Get this trait's scope provider for the specified test and/or test case, @@ -97,10 +93,6 @@ public protocol Trait: Sendable { /// associated ``Trait/TestScopeProvider`` type is the default `Never`, then /// this method returns `nil` by default. This means that instances of this /// trait will not provide a custom scope for tests to which they're applied. - /// - /// @Metadata { - /// @Available(Swift, introduced: 6.1) - /// } func scopeProvider(for test: Test, testCase: Test.Case?) -> TestScopeProvider? } @@ -115,10 +107,6 @@ public protocol Trait: Sendable { /// logic for tests which have similar needs allows each test function to be /// more succinct with less repetitive boilerplate so it can focus on what makes /// it unique. -/// -/// @Metadata { -/// @Available(Swift, introduced: 6.1) -/// } public protocol TestScoping: Sendable { /// Provide custom execution scope for a function call which is related to the /// specified test and/or test case. @@ -152,10 +140,6 @@ public protocol TestScoping: Sendable { /// an error if it is unable to provide a custom scope. /// /// Issues recorded by this method are associated with `test`. - /// - /// @Metadata { - /// @Available(Swift, introduced: 6.1) - /// } func provideScope(for test: Test, testCase: Test.Case?, performing function: @Sendable () async throws -> Void) async throws } @@ -172,10 +156,6 @@ extension Trait where Self: TestScoping { /// This default implementation is used when this trait type conforms to /// ``TestScoping`` and its return value is discussed in /// ``Trait/scopeProvider(for:testCase:)-cjmg``. - /// - /// @Metadata { - /// @Available(Swift, introduced: 6.1) - /// } public func scopeProvider(for test: Test, testCase: Test.Case?) -> Self? { testCase == nil ? nil : self } @@ -194,10 +174,6 @@ extension SuiteTrait where Self: TestScoping { /// This default implementation is used when this trait type conforms to /// ``TestScoping`` and its return value is discussed in /// ``Trait/scopeProvider(for:testCase:)-cjmg``. - /// - /// @Metadata { - /// @Available(Swift, introduced: 6.1) - /// } public func scopeProvider(for test: Test, testCase: Test.Case?) -> Self? { if test.isSuite { isRecursive ? nil : self @@ -253,10 +229,6 @@ extension Trait where TestScopeProvider == Never { /// This default implementation is used when this trait type's associated /// ``Trait/TestScopeProvider`` type is the default value of `Never`, and its /// return value is discussed in ``Trait/scopeProvider(for:testCase:)-cjmg``. - /// - /// @Metadata { - /// @Available(Swift, introduced: 6.1) - /// } public func scopeProvider(for test: Test, testCase: Test.Case?) -> Never? { nil }