Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- ELF test metadata now keeps `name` as the legacy flat leaf test name for compatibility,
and adds `full_name` with the canonical module-qualified path (e.g. `tests::my_test`)
to match libtest/rust-analyzer filtering semantics.

## [0.7.1]

### Added
Expand Down
5 changes: 4 additions & 1 deletion macros/src/attributes/tests/codegen/export_sym.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::hash::{DefaultHasher, Hash as _, Hasher as _};

pub(crate) fn export_sym(
test: &TestFunc,
module_name: &str,
ident_entrypoint: Ident,
default_timeout: Option<u32>,
) -> proc_macro2::TokenStream {
Expand Down Expand Up @@ -38,10 +39,12 @@ pub(crate) fn export_sym(
} else {
// Generate a symbol name which is actually a JSON object describing the test so that probe-rs can parse it.

let full_test_name = format!("{}::{}", module_name, test_name);
let sym_name = format!(
r#"{{"disambiguator":{},"name":"{}","ignored":{},"should_panic":{}{}}}"#,
r#"{{"disambiguator":{},"name":"{}","full_name":"{}","ignored":{},"should_panic":{}{}}}"#,
_crate_local_disambiguator(), // disambiguator is needed to allow multiple identical test in different modules
_json_escape(&test_name.to_string()),
_json_escape(&full_test_name),
if ignore { "true" } else { "false" },
if should_panic { "true" } else { "false" },
if let Some(timeout) = timeout {
Expand Down
7 changes: 6 additions & 1 deletion macros/src/attributes/tests/codegen/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ pub(crate) fn test(test: &TestFunc, module: &ValidatedModule) -> TokenStream {
);

// A static symbol that will be exported that describes the test and can be parsed by probe-rs.
let sym = export_sym(test, ident_entrypoint, module.macro_args.default_timeout);
let sym = export_sym(
test,
&module.module_name,
ident_entrypoint,
module.macro_args.default_timeout,
);

quote! {

Expand Down