1616
1717#if DEBUG
1818
19+ import IssueReporting
1920import XCTest
21+
2022@testable import Workflow
2123
2224extension RenderTester {
@@ -65,7 +67,7 @@ extension RenderTester {
6567 """
6668 }
6769 let failureMessage = " Attempted to render unexpected Workflow of type \( Child . self) with key \" \( key) \" . \( diagnosticMessage) "
68- XCTFail ( failureMessage, file : file, line: line)
70+ reportIssue ( failureMessage, filePath : file, line: line)
6971
7072 // We can “recover” from missing Void-rendering workflows since there’s only one possible value to return
7173 if Child . Rendering. self == Void . self {
@@ -76,7 +78,7 @@ extension RenderTester {
7678 }
7779 let ( inserted, _) = usedWorkflowKeys. insert ( WorkflowKey ( type: ObjectIdentifier ( Child . self) , key: key) )
7880 if !inserted {
79- XCTFail ( " Multiple Workflows of type \( Child . self) with key \" \( key) \" used in the same render call. Use a unique key to render multiple Workflows of the same type. " , file : file, line: line)
81+ reportIssue ( " Multiple Workflows of type \( Child . self) with key \" \( key) \" used in the same render call. Use a unique key to render multiple Workflows of the same type. " , filePath : file, line: line)
8082 }
8183
8284 expectedWorkflows. removeAll ( where: { $0 === expectedWorkflow } )
@@ -96,7 +98,7 @@ extension RenderTester {
9698
9799 func runSideEffect( key: AnyHashable , action: ( Lifetime ) -> Void ) {
98100 guard let sideEffect = expectedSideEffects. removeValue ( forKey: key) else {
99- XCTFail ( " Unexpected side-effect with key \" \( key) \" " , file : file, line: line)
101+ reportIssue ( " Unexpected side-effect with key \" \( key) \" " , filePath : file, line: line)
100102 return
101103 }
102104
@@ -106,21 +108,25 @@ extension RenderTester {
106108 /// Validate the expectations were fulfilled, or fail if not.
107109 func assertNoLeftOverExpectations( ) {
108110 for expectedWorkflow in expectedWorkflows {
109- XCTFail ( " Expected child workflow of type: \( expectedWorkflow. workflowType) , key: \" \( expectedWorkflow. key) \" " , file : file, line: expectedWorkflow. line)
111+ reportIssue ( " Expected child workflow of type: \( expectedWorkflow. workflowType) , key: \" \( expectedWorkflow. key) \" " , filePath : file, line: expectedWorkflow. line)
110112 }
111113
112114 for (key, expectedSideEffect) in expectedSideEffects {
113- XCTFail ( " Expected side-effect with key: \" \( key) \" " , file : expectedSideEffect. file, line: expectedSideEffect. line)
115+ reportIssue ( " Expected side-effect with key: \" \( key) \" " , filePath : expectedSideEffect. file, line: expectedSideEffect. line)
114116 }
115117 }
116118
117119 private func apply< ActionType: WorkflowAction > ( action: ActionType ) where ActionType. WorkflowType == WorkflowType {
118- XCTAssertNil ( appliedAction, " Received multiple actions in a single render test " , file: file, line: line)
120+ if appliedAction != nil {
121+ reportIssue ( " Received multiple actions in a single render test " , filePath: file, line: line)
122+ }
119123 appliedAction = AppliedAction ( action)
120124 let output = action. apply ( toState: & state)
121125
122126 if let output {
123- XCTAssertNil ( producedOutput, " Received multiple outputs in a single render test " , file: file, line: line)
127+ if producedOutput != nil {
128+ reportIssue ( " Received multiple outputs in a single render test " , filePath: file, line: line)
129+ }
124130 producedOutput = output
125131 }
126132 }
0 commit comments