diff --git a/Sources/Testing/Traits/Trait.swift b/Sources/Testing/Traits/Trait.swift index 0e43d403c..e6a42b4d5 100644 --- a/Sources/Testing/Traits/Trait.swift +++ b/Sources/Testing/Traits/Trait.swift @@ -110,5 +110,5 @@ public protocol CustomExecutionTrait: Trait { /// /// - Note: If a test function or test suite is skipped, this function does /// not get invoked by the runner. - @Sendable func execute(_ function: @escaping @Sendable () async throws -> Void, for test: Test, testCase: Test.Case?) async throws + func execute(_ function: @Sendable () async throws -> Void, for test: Test, testCase: Test.Case?) async throws } diff --git a/Tests/TestingTests/Traits/CustomExecutionTraitTests.swift b/Tests/TestingTests/Traits/CustomExecutionTraitTests.swift index 21f9f41bb..aedc06de3 100644 --- a/Tests/TestingTests/Traits/CustomExecutionTraitTests.swift +++ b/Tests/TestingTests/Traits/CustomExecutionTraitTests.swift @@ -68,7 +68,7 @@ struct CustomExecutionTraitTests { private struct CustomTrait: CustomExecutionTrait, TestTrait { var before: Confirmation var after: Confirmation - func execute(_ function: @escaping @Sendable () async throws -> Void, for test: Test, testCase: Test.Case?) async throws { + func execute(_ function: @Sendable () async throws -> Void, for test: Test, testCase: Test.Case?) async throws { before() defer { after() @@ -80,7 +80,7 @@ private struct CustomTrait: CustomExecutionTrait, TestTrait { private struct CustomThrowingErrorTrait: CustomExecutionTrait, TestTrait { fileprivate struct CustomTraitError: Error {} - func execute(_ function: @escaping @Sendable () async throws -> Void, for test: Test, testCase: Test.Case?) async throws { + func execute(_ function: @Sendable () async throws -> Void, for test: Test, testCase: Test.Case?) async throws { throw CustomTraitError() } } @@ -88,7 +88,7 @@ private struct CustomThrowingErrorTrait: CustomExecutionTrait, TestTrait { struct DoSomethingBeforeAndAfterTrait: CustomExecutionTrait, SuiteTrait, TestTrait { static let state = Locked(rawValue: 0) - func execute(_ function: @escaping @Sendable () async throws -> Void, for test: Testing.Test, testCase: Testing.Test.Case?) async throws { + func execute(_ function: @Sendable () async throws -> Void, for test: Testing.Test, testCase: Testing.Test.Case?) async throws { #expect(Self.state.increment() == 1) try await function()