swiftlang / swiftlang/swift-testing
Refactor #expect to handle more complex/arbitrarily-structured expressions
@grynspan is already working on this.
Since Oct 9, 2024.
- Dominant language
- Swift
- Stars
- 2.2k
- Forks
- 169
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 56
Description
Description
#expect works differently when await keyword is inside its body. await #expect(expr) shows a breakdown of the actual value, while #expect(await expr) does not. I would like to know why the expectation failed even if the result is computed from an async expression.
Expected behavior
#expect(await Array(stream) == [1,2]) throws the error testAll(): Expectation failed: (Array(stream) → [1, 2, 3]) == ([1,2] → [1, 2])
Actual behavior
#expect(await Array(stream) == [1,2]) throws the error testAll(): Expectation failed: await Array(stream) == [1,2]
Steps to reproduce
No response
swift-testing version/commit hash
3fa4ea0bfcbfc48102ca5d81f03a00debd0d4372
Swift & OS version (output of swift --version && uname -a)
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
Darwin MBP 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:24 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6000 arm64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.