Skip to content

Capture source location of elements in collection literal test arguments #519

@wwake

Description

@wwake

Description

For parameterized tests, I'd like the error report to point to the source line of the failing test case (perhaps as well as the #expect that failed). This makes more sense for sequences of test cases than combinatorial tests.

In XCTest, I used a struct wrapping each test case that captured #file and #line, so I could pass those through to the assertions. (Sub-issue: there's no corresponding #sourceLocation macro so I can't capture the exact location.)

Wrapping each line was annoying. It would really be nice if there were an implicit way to get this information - e.g., automatically capture the source location for each test case, and add an argument or implicit value that you could pass to #expect.

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

swift-testing version/commit hash

No response

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

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestparameterized-testingRelated to parameterized testing functionality

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions