-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners #107307
Labels
A-libtest
Area: `#[test]` / the `test` library
Comments
I'd be happy to raise a PR. |
Folks would anyone be able to give me some hints on how to track down the source file & line number from the compiler's internal object model? |
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output earlier: p2dchecks::fibonacci_test::case_1: test now: // test test_type | ignored_or_not | location_info p2dchecks::fibonacci_test::case_1: test | false | src\lib.rs:57:8: 57:19
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output fixing build break
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output fixing build break
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output attempting to fix ordering issue
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output wtf am i doing?
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output wtf am i doing (redux)?
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output fixing tests
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output taking in PR comments.
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output fixing build break.
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Feb 8, 2023
… output making the delimiter consistent.
Taking this forward through an pre-RFC https://internals.rust-lang.org/t/pre-rfc-enhancing-cargo-test-list-for-use-by-ide-test-explorers-runners/18308 |
parthopdas
changed the title
Adding file path and line number to "cargo test --list" output
Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners
Feb 17, 2023
parthopdas
added a commit
to kitamstudios/rust
that referenced
this issue
Mar 4, 2023
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Mar 6, 2023
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 8, 2023
rust-lang#107307 Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests upcoming: PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1 As per the discussions on - MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548 - preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308 - FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 8, 2023
rust-lang#107307 Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests upcoming: PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1 As per the discussions on - MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548 - preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308 - FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this issue
Mar 8, 2023
rust-lang#107307 Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests upcoming: PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1 As per the discussions on - MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548 - preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308 - FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 10, 2023
rust-lang#107307 Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests upcoming: PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1 As per the discussions on - MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548 - preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308 - FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
parthopdas
added a commit
to parthopdas/rust
that referenced
this issue
Mar 15, 2023
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Mar 17, 2023
Implementing "<test_binary> --list --format json" for use by IDE test explorers / runners Fixes rust-lang#107307 PR 1 of 2 - wiring up just the new information + implement the command line changes i.e. --format json + tests upcoming: PR 2 of 2 - clean up "#[cfg(not(bootstrap))]" from PR 1 As per the discussions on - MCP: https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/Implementing.20.22.3Ctest_binary.3E.20--list.20--form.E2.80.A6.20compiler-team.23592/near/328747548 - preRFC: https://internals.rust-lang.org/t/pre-rfc-implementing-test-binary-list-format-json-for-use-by-ide-test-explorers-runners/18308 - FYI on Discord: https://discord.com/channels/442252698964721669/459149169546887178/1075581549409484820
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[consider the default output of
cargo new a --lib
]Issue
Test explorers in editors (e.g. VSCode, see pic below) are unable to navigate to test location in the editor from the test explorer.
Cause
cargo test --list -q
used by the editors to get list of tests do not have the source and line / column info.Description
Currently
cargo test --list -q
shows the following outputThis is used by editor extensions e.g. vscode rust test adapter to show & run tests from the tests pane in VS Code. e.g.
While it is possible to run and debug the tests from the test explorer, it is not possible to navigate back to the test location as output above is missing that information. E.g. you cannot double click on a test on the test explorer to navigate to its definition in the editor.
Suggestion is to add the source info to the output of --list as follows
Fix proposal
Proposal for fix (& I only have a plan A, happy to receive further guidance) is to update
test::TestDescAndFn
as followsOnce this is available, the corresponding changes can be made to compiler/rustc_builtin_macros/src/test.rs to emit the above info and then in library/test/src/console.rs to write it out.
The text was updated successfully, but these errors were encountered: