Skip to content

Conversation

@skogseth
Copy link
Contributor

The tests emitted by rustc use the full path, not including the crate name, as the name for the test (impl). From what I can tell there's no way to get this path exactly from rust, but we can get the full path including crate name from std::module_path. We can then find the first occurence of :: and grab whatever follows.

Fixes #154.

Note that the list of passing tests is 1, even though 2 tests have passed.
Probably because they both share the exact same test name: `foo`.
Regarding the bug shown visible in the test in the previous commit,
where two passing tests both named `foo` would give output that
only 1 test passed: The test macros should now always give unique
names to all tests, so this is no longer visible when using the macros.
However, unique test names is noo guaranteed when using the imperative
API, so the bug could still happen (just not when using the macros).
@coveralls
Copy link

coveralls commented Dec 17, 2025

Pull Request Test Coverage Report for Build 20302849194

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 32.092%

Totals Coverage Status
Change from base Build 20147153084: 0.2%
Covered Lines: 543
Relevant Lines: 1692

💛 - Coveralls

@epage
Copy link
Collaborator

epage commented Dec 17, 2025

Thanks!

@epage epage merged commit bd80ab8 into assert-rs:main Dec 17, 2025
15 checks passed
@skogseth skogseth deleted the full-path-names branch December 17, 2025 15:05
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.

#[test] names are not full paths

3 participants