Skip to content

Value not shown in error message when an expectation condition has effects (try/await) #162

Open
@tevelee

Description

@tevelee

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.

image

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

3fa4ea0

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

Metadata

Metadata

Assignees

Labels

concurrency🔀 Swift concurrency/sendability issuesenhancementNew feature or requestissue-handlingRelated to Issue handling within the testing librarypublic-apiAffects public API

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions