enabled(if:_:sourceLocation:)
Constructs a condition trait that disables a test if it returns false.
Declaration
static func enabled(if condition: @autoclosure @escaping @Sendable () throws -> Bool, _ comment: Comment? = nil, sourceLocation: SourceLocation = #_sourceLocation) -> SelfParameters
- condition:
A closure that contains the trait’s custom condition logic. If this closure returns
true, the trait allows the test to run. Otherwise, the testing library skips the test. - comment:
An optional comment that describes this trait.
- sourceLocation:
The source location of the trait.
Mentioned in
Return Value
An instance of ConditionTrait that evaluates the closure you provide.