You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR changes the semantics of `Test.cancel()` such that it only
cancels the current test case if the current test is parameterized. This
PR also removes `Test.Case.cancel()`, but we may opt to add
`Test.Case.cancelAll()` or some such in the future to re-add an
interface that cancels an entire parameterized test.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
/// - Important: If the current task is not associated with a test (for
218
207
/// example, because it was created with [`Task.detached(name:priority:operation:)`](https://developer.apple.com/documentation/swift/task/detached(name:priority:operation:)-795w1))
219
208
/// this function records an issue and cancels the current task.
220
-
///
221
-
/// To cancel the current test case but leave other test cases of the current
222
-
/// test alone, call ``Test/Case/cancel(_:sourceLocation:)`` instead.
/// func `Food truck is well-stocked`(_ food: Food) throws {
259
-
/// if food == .iceCream && Season.current == .winter {
260
-
/// try Test.Case.cancel("It's too cold for ice cream.")
261
-
/// }
262
-
/// // ...
263
-
/// }
264
-
/// ```
265
-
///
266
-
/// If the current test is parameterized, the test's other test cases continue
267
-
/// running. If the current test case has already been cancelled, this
268
-
/// function throws an error but does not attempt to cancel the test case a
269
-
/// second time.
270
-
///
271
-
/// @Comment {
272
-
/// TODO: Document the interaction between an exit test and test
273
-
/// cancellation. In particular, the error thrown by this function isn't
274
-
/// thrown into the parent process and task cancellation doesn't propagate
275
-
/// (because the exit test _de facto_ runs in a detached task.)
276
-
/// }
277
-
///
278
-
/// - Important: If the current task is not associated with a test case (for
279
-
/// example, because it was created with [`Task.detached(name:priority:operation:)`](https://developer.apple.com/documentation/swift/task/detached(name:priority:operation:)-795w1))
280
-
/// this function records an issue and cancels the current task.
281
-
///
282
-
/// To cancel all test cases in the current test, call
0 commit comments