Skip to content
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
14 changes: 8 additions & 6 deletions Sources/TestingMacros/SuiteDeclarationMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@ public struct SuiteDeclarationMacro: MemberMacro, PeerMacro, Sendable {
@available(*, unavailable, message: "This type is an implementation detail of the testing library. It cannot be used directly.")
@available(*, deprecated)
@frozen public enum \(enumName): Testing.__TestContainer {
public static var __tests: [Testing.Test] {[
.__type(
\(declaration.type.trimmed).self,
\(raw: attributeInfo.functionArgumentList(in: context))
)
]}
public static var __tests: [Testing.Test] {
get async {[
.__type(
\(declaration.type.trimmed).self,
\(raw: attributeInfo.functionArgumentList(in: context))
)
]}
}
}
"""
)
Expand Down
8 changes: 6 additions & 2 deletions Tests/TestingTests/MiscellaneousTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,15 @@ struct TestsWithStaticMemberAccessBySelfKeyword {
@Test(.hidden, arguments: [0]) func A(🙃: Int) {}
@Test(.hidden, arguments: [0]) func A(🙂: Int) {}

@Suite(.hidden)
func asyncTrait() async -> some SuiteTrait & TestTrait {
.comment("")
}

@Suite(.hidden, await asyncTrait())
struct TestsWithAsyncArguments {
static func asyncCollection() async -> [Int] { [] }

@Test(.hidden, arguments: await asyncCollection()) func f(i: Int) {}
@Test(.hidden, await asyncTrait(), arguments: await asyncCollection()) func f(i: Int) {}
}

@Suite("Miscellaneous tests")
Expand Down