Skip to content

Add ConditionTraitTests to cover the Swift 6.0 compiler issue for custom trait + closure + macro #1008

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 1 commit into from
Mar 11, 2025
Merged
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
44 changes: 44 additions & 0 deletions Tests/TestingTests/Traits/ConditionTraitTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2025 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for Swift project authors
//

@testable import Testing

@Suite("Condition Trait Tests", .tags(.traitRelated))
struct ConditionTraitTests {
#if compiler(>=6.1)
@Test(
".enabled trait",
.enabled { true },
.bug("https://github.com/swiftlang/swift/issues/76409", "Verify the custom trait with closure causes @Test macro to fail is fixed")
)
func enabledTraitClosure() throws {}
#endif

@Test(
".enabled if trait",
.enabled(if: true)
)
func enabledTraitIf() throws {}

#if compiler(>=6.1)
@Test(
".disabled trait",
.disabled { false },
.bug("https://github.com/swiftlang/swift/issues/76409", "Verify the custom trait with closure causes @Test macro to fail is fixed")
)
func disabledTraitClosure() throws {}
#endif

@Test(
".disabled if trait",
.disabled(if: false)
)
func disabledTraitIf() throws {}
}