Skip to content

Conversation

@grynspan
Copy link
Contributor

@grynspan grynspan commented Sep 3, 2025

This PR ensures that, when a test is cancelled, its test cases report the same SkipInfo structure as they are recursively cancelled. For instance:

@Test(arguments: [a ... z]) func foo(arg: T) throws {
  try Test.cancel("Message")
}

Prior to this change, the .testCaseCancelled events would be posted without the user-supplied comment "Message" and each one would need to construct a source context by capturing a backtrace from deep within Swift Testing and the stdlib.

With this change in place, said events post with the same comment and source context as is associated with the initial .testCancelled event.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR ensures that, when a test is cancelled, its test cases report the same
`SkipInfo` structure as they are recursively cancelled. For instance:

```swift
@test(arguments: [a ... z]) func foo(arg: T) throws {
  try Test.cancel("Message")
}
```

Prior to this change, the `.testCaseCancelled` events would be posted without
the user-supplied comment `"Message"` and each one would need to construct a
source context by capturing a backtrace from deep within Swift Testing and the
stdlib.

With this change in place, said events post with the same comment and source
context as is associated with the initial `.testCancelled` event.
@grynspan grynspan added this to the Swift 6.x (main) milestone Sep 3, 2025
@grynspan grynspan self-assigned this Sep 3, 2025
@grynspan grynspan added enhancement New feature or request public-api Affects public API issue-handling Related to Issue handling within the testing library parameterized-testing Related to parameterized testing functionality labels Sep 3, 2025
@grynspan
Copy link
Contributor Author

grynspan commented Sep 3, 2025

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Sep 3, 2025

@swift-ci test Linux

@grynspan grynspan requested a review from briancroom September 3, 2025 20:08
@grynspan
Copy link
Contributor Author

grynspan commented Sep 3, 2025

@swift-ci test

@grynspan
Copy link
Contributor Author

grynspan commented Sep 3, 2025

@swift-ci test

@grynspan grynspan merged commit 8500bd0 into main Sep 3, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/propagate-cancellation-info branch September 3, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request issue-handling Related to Issue handling within the testing library parameterized-testing Related to parameterized testing functionality public-api Affects public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants