Skip to content

Remove extraneous @escaping and @Sendable attributes from CustomExecutionTrait.execute(...) SPI #726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Testing/Traits/Trait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions Tests/TestingTests/Traits/CustomExecutionTraitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -80,15 +80,15 @@ 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()
}
}

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()
Expand Down