File tree Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Expand file tree Collapse file tree 3 files changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -169,7 +169,8 @@ extension Test: TestCancellable {
169169 /// attribute the cancellation.
170170 ///
171171 /// - Throws: An error indicating that the current test or test case has been
172- /// cancelled.
172+ /// cancelled. The testing library does not treat this error as a test
173+ /// failure.
173174 ///
174175 /// The testing library runs each test and each test case in its own task.
175176 /// When you call this function, the testing library cancels the task
@@ -206,7 +207,6 @@ extension Test: TestCancellable {
206207 /// - Important: If the current task is not associated with a test (for
207208 /// example, because it was created with [`Task.detached(name:priority:operation:)`](https://developer.apple.com/documentation/swift/task/detached(name:priority:operation:)-795w1))
208209 /// this function records an issue and cancels the current task.
209- @_spi ( Experimental)
210210 public static func cancel( _ comment: Comment ? = nil , sourceLocation: SourceLocation = #_sourceLocation) throws -> Never {
211211 let skipInfo = SkipInfo ( comment: comment, sourceContext: SourceContext ( backtrace: nil , sourceLocation: sourceLocation) )
212212 try Self . cancel ( with: skipInfo)
Original file line number Diff line number Diff line change @@ -121,19 +121,18 @@ func allIngredientsAvailable(for food: Food) -> Bool { ... }
121121func makeSundae () async throws { ... }
122122```
123123
124- <!--
125124### End a test after it has already started
126125
127- TODO: document Test.cancel() and Test.Case.cancel() here
128-
129126If a test has already started running and you determine it cannot complete and
130127should end early without failing, use `` Test/cancel(_:sourceLocation:) `` to
131128cancel the test:
132129
133130``` swift
134- ...
131+ @Test (" Can make sundaes" )
132+ func makeSundae () throws {
133+ guard let iceCreamMaker = IceCreamMaker () else {
134+ try Test.cancel (" The ice cream maker isn't working right now" )
135+ }
136+ ...
137+ }
135138```
136-
137- If the test is parameterized and you only want to cancel the current test case
138- rather than the entire test, use ``Test/Case/cancel(_:sourceLocation:)``.
139- -->
Original file line number Diff line number Diff line change @@ -556,11 +556,8 @@ test function with an instance of this trait type to control whether it runs:
556556 }
557557}
558558
559- <!-- TODO: document Test.cancel() and Test.Case.cancel() here, and update
560- relevant links to use proper DocC symbol references.
561-
562559If a test has already started running and you determine it cannot complete and
563- should end early without failing, use `Test/cancel(_:sourceLocation:)` instead
560+ should end early without failing, use `` Test/cancel(_:sourceLocation:) ` ` instead
564561of [ ` XCTSkip ` ] ( https://developer.apple.com/documentation/xctest/xctskip ) to
565562cancel the task associated with the current test:
566563
@@ -593,10 +590,6 @@ cancel the task associated with the current test:
593590 }
594591}
595592
596- If the test is parameterized and you only want to cancel the current test case
597- rather than the entire test, use `Test/Case/cancel(_:sourceLocation:)`.
598- -->
599-
600593### Annotate known issues
601594
602595A test may have a known issue that sometimes or always prevents it from passing.
You can’t perform that action at this time.
0 commit comments