@@ -332,6 +332,32 @@ final class RunnerTests: XCTestCase {
332332 let test2 = Test ( . disabled( if: Bool . random ( ) ) ) { }
333333 XCTAssertTrue ( test2. traits. compactMap { $0 as? ConditionTrait } . allSatisfy { !$0. isConstant } )
334334 }
335+
336+ func testEvaluateConditionTrait( ) async throws {
337+ let comment : Comment = " comment "
338+ let trueUnconditional = ConditionTrait ( kind: . unconditional( true ) , comments: [ ] , sourceLocation: . __here( ) )
339+ let falseUnconditional = ConditionTrait . disabled ( )
340+ let enabledTrue = ConditionTrait . enabled ( if: true )
341+ let enabledFalse = ConditionTrait . enabled ( if: false )
342+ let enabledTrueComment = ConditionTrait ( kind: . conditional { ( true , comment) } , comments: [ ] , sourceLocation: . __here( ) )
343+ let enabledFalseComment = ConditionTrait ( kind: . conditional { ( false , comment) } , comments: [ ] , sourceLocation: . __here( ) )
344+ var result : ConditionTrait . EvaluationResult
345+
346+ result = try await trueUnconditional. evaluate ( )
347+ XCTAssertTrue ( result. wasMet)
348+ result = try await falseUnconditional. evaluate ( )
349+ XCTAssertFalse ( result. wasMet)
350+ result = try await enabledTrue. evaluate ( )
351+ XCTAssertTrue ( result. wasMet)
352+ result = try await enabledFalse. evaluate ( )
353+ XCTAssertFalse ( result. wasMet)
354+ result = try await enabledTrueComment. evaluate ( )
355+ XCTAssertTrue ( result. wasMet)
356+ XCTAssertEqual ( result. comment, comment)
357+ result = try await enabledFalseComment. evaluate ( )
358+ XCTAssertFalse ( result. wasMet)
359+ XCTAssertEqual ( result. comment, comment)
360+ }
335361
336362 func testGeneratedPlan( ) async throws {
337363 let tests : [ ( Any . Type , String ) ] = [
0 commit comments