You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
604: defmt-test: `#[cfg(test)]` the `#[defmt_test::tests]` module r=Urhengulas a=japaric
[it recently came to my attention](knurling-rs/app-template@1ebc0ac) that one can use `defmt-test` for "unit testing" by using it in `src/lib.rs` (although this is pretty limited at the moment because one can only use the `defmt_test::tests` *once* in a library crate)
if one does use `defmt_test` like that then they may run into the issue that running the test files in `tests` fails with this cryptic linker message:
``` console
= note: rust-lld: error: duplicate symbol: main
```
the issue is that the code generated by `defmt_test::tests` (which includes a function with unmangled name `main`) is not conditionally compiled but we do want that to be `#[cfg(test)]`-ed because it contains test code.
r? `@jonas-schievink`
Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
0 commit comments