Skip to content

Report doctest line numbers in a clickable format #142984

Open
@joshka

Description

@joshka

In VSCode (and various other IDEs / tools - fzf, vim, etc.), reporting filenames in a format file:linenumber makes it easy to click to navigate to that location.

Format all doctest failures line numbers using file:number format.

Current output. The poor format appears at least 3 times in the output.

running 28 tests
test ratatui-macros/src/lib.rs - (line 104) ... FAILED

...snip

failures:

---- ratatui-macros/src/lib.rs - (line 104) stdout ----
error: expected one of `,`, `.`, `?`, `]`, or an operator, found `;`
  --> ratatui-macros/src/lib.rs:115:6

...snip

failures:
    ratatui-macros/src/lib.rs - (line 104)

Note that the line number of the error should be reported not the line number of the start of the doc test (but that's captured a sort of separate issue.

Alternatives:
It's possible that reporting some of these semantically makes more sense than as file locations, by reporting the module or function that the doctest is attached on rather than the line number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: Documentation tests, run by rustdocC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions