Skip to content

fix: enable using unit macro in foreign crate under test #521

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Johnabell
Copy link

This PR addresses the issue raise in #520.

It adds a new macro that only outputs the tokens when this crate is running under test. This can then be used in other macros outputs in place of #[cfg(test)] to ensure that when foreign crates use the exported macros the do not get the parts intended for internal testing.

The other option that could be considered is making a "testing" feature if you would like these to be available for testing in foreign crates too.

@Johnabell Johnabell force-pushed the fix-unit-tests-foreign-crates-unit-macro branch from b6ca4d1 to 53dfc35 Compare June 6, 2025 20:05
@Johnabell Johnabell force-pushed the fix-unit-tests-foreign-crates-unit-macro branch from 53dfc35 to c090850 Compare June 6, 2025 20:07
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.

1 participant