Skip to content

feat: Report test location in discover_case - #200

Open
younes-io wants to merge 2 commits into
assert-rs:mainfrom
younes-io:feat/test-location
Open

younes-io wants to merge 2 commits into
assert-rs:mainfrom
younes-io:feat/test-location

Conversation

@younes-io

@younes-io younes-io commented Nov 7, 2026 •

Copy link
Copy Markdown

#[test] now records where each test is defined, and discover_case carries it:

{"event":"discover_case","name":"check_toph","source":{"path":"crates/libtest2/examples/simple.rs","start_line":11,"start_col":4,"end_line":11,"end_col":14}}
  • the location is the fn name (same as upstream libtest), not the #[test] attribute line
  • source is just path plus optional line/col fields, so a fixture can send only {"path": ...}, and byte offsets can be added later as more optional fields without breaking anything
  • how it works: a small hidden proc macro moves file!()/line!()/column!() onto the fn name's location, so it still builds on MSRV 1.74
  • mimic / FnCase still report nothing for now, that can come later
  • known gap: the json schema can't say "all four line fields or none", nesting them under lines would fix that if you prefer it

two commits: json + harness plumbing first (no output change), then the macro that fills it in (snapshots update).

Refs #153, #72

disclosure: written with AI assistance; reviewed and tested by me.

Signed-off-by: Younes <git@younes.io>
Signed-off-by: Younes <git@younes.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant