The double-wrapped task is not a child, not implicitly cancelled in that case.
regarding this:
That is a bug. Try this instead:
func testThatDataTaskIsCancelledInChildTask() async {
// Given
let session = stored(Session())
let request = session.request(.get)
// When
let task = Task {
await Task.yield()
// Task, not task
XCTAssertTrue(Task.isCancelled, "Current Task should be cancelled.")
_ = await request.decode(TestResponse.self).response
}
task.cancel()
_ = await task.value
// Then
XCTAssertTrue(request.error?.isExplicitlyCancelledError == true)
}