Skip to content

Value not shown when calling function in #expect #606

Closed as not planned
Closed as not planned
@JetForMe

Description

@JetForMe

Description

When the following expectation fails:

let sample = try tile.sample(atX: 0, y: 0)
#expect(sample.isApproximatelyEqual(to: 10.276871, absoluteTolerance: 0.0001))

the message printed is

Expectation failed: (sample → 455.85916).isApproximatelyEqual(to: 10.276871, absoluteTolerance: 0.0001)

But if the expectation is written like this:

#expect(try tile.sample(atX: 0, y: 0).isApproximatelyEqual(to: 10.276871, absoluteTolerance: 0.0001))

The message doesn't include the value:

Expectation failed: try tile.sample(atX: 0, y: 0).isApproximatelyEqual(to: 10.276871, absoluteTolerance: 0.0001)

Would be nice if it showed the value in that case too.

Expected behavior

Show the value regardless of the expression.

Actual behavior

No response

Steps to reproduce

No response

swift-testing version/commit hash

a62bf99

Swift & OS version (output of swift --version ; uname -a)

% swift --version ; uname -a
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1)
Target: arm64-apple-macosx14.0
Darwin eclipsem1.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🪲 Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions