struct MySuiteTrait: SuiteTrait & TestScoping { func provideScope( for test: Test, testCase: Test.Case?, performing function: () async throws -> Void ) async throws { print("enter suite scope") defer { print("leave suite scope") } try await function() } }
(edited)struct MyTestTrait: TestTrait & TestScoping { func provideScope( for test: Test, testCase: Test.Case?, performing function: () async throws -> Void ) async throws { print("enter test") defer { print("leave test") } try await function() } }
こうするとテストの開始・終了を挟める。struct MyRecursiveSuiteTrait: SuiteTrait & TestScoping { var isRecursive: Bool { true } func provideScope( for test: Test, testCase: Test.Case?, performing function: () async throws -> Void ) async throws { print("enter test") defer { print("leave test") } try await function() } }
(edited)