Skip to content

Commit f676fe7

Browse files
committed
Add ConditionTraitTests to cover the Swift 6.0 compiler issue for custom trait + closure + macro
See #1006 (comment)
1 parent af6b5b9 commit f676fe7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// This source file is part of the Swift.org open source project
3+
//
4+
// Copyright (c) 2025 Apple Inc. and the Swift project authors
5+
// Licensed under Apache License v2.0 with Runtime Library Exception
6+
//
7+
// See https://swift.org/LICENSE.txt for license information
8+
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
9+
//
10+
11+
@testable import Testing
12+
13+
@Suite("Condition Trait Tests", .tags(.traitRelated))
14+
struct ConditionTraitTests {
15+
// #if compiler(>=6.1)
16+
// TODO: Verify this will cause release/6.0 CI to fail
17+
@Test(
18+
".enabled trait",
19+
.enabled { true },
20+
.bug("https://github.com/swiftlang/swift/issues/76409", "Verify the custom trait with closure causes @Test macro to fail is fixed")
21+
)
22+
func enabledTraitClosure() throws {}
23+
// #endif
24+
25+
@Test(
26+
".enabled if trait",
27+
.enabled(if: true)
28+
)
29+
func enabledTraitIf() throws {}
30+
31+
#if compiler(>=6.1)
32+
@Test(
33+
".disabled trait",
34+
.disabled { false },
35+
.bug("https://github.com/swiftlang/swift/issues/76409", "Verify the custom trait with closure causes @Test macro to fail is fixed")
36+
)
37+
func disabledTraitClosure() throws {}
38+
#endif
39+
40+
@Test(
41+
".disabled if trait",
42+
.disabled(if: false)
43+
)
44+
func disabledTraitIf() throws {}
45+
}

0 commit comments

Comments
 (0)