Skip to content
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

how to specify that tests should be run with particular cfg directives? #206

Closed
sam0x17 opened this issue Oct 31, 2022 · 1 comment
Closed
Labels
out of scope Ideas to consider for someone building a more fully featured ui testing library

Comments

@sam0x17
Copy link

sam0x17 commented Oct 31, 2022

I have a piece of code that was previously asserted to be a "pass" example i.e.:

let t = trybuild::TestCases::new();
t.pass("tests/pallet_ui/pass/*.rs");

Now I have one example where one of the macros being tested is set up to throw a compiler error if it is not compiled in test mode. The problem is I can't seem to find any way to tell trybuild to set the test directive on a particular example. How can I do this? I'm hoping for something like this:

let mut t = trybuild::TestCases::new();
t.pass("tests/pallet_ui/pass/*.rs");
t.set_cfg("test");
t.pass("tests/pallet_ui/pass_test_mode/*.rs");

Is there an existing way to do this? I can't find anything in the docs but I imagine it's something people frequently need

@dtolnay
Copy link
Owner

dtolnay commented Oct 31, 2022

I would prefer not to support this in this crate, but it would be reasonable for someone else to maintain a more fully featured fork that serves this situation.

@dtolnay dtolnay closed this as completed Oct 31, 2022
@dtolnay dtolnay added the out of scope Ideas to consider for someone building a more fully featured ui testing library label Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
out of scope Ideas to consider for someone building a more fully featured ui testing library
Projects
None yet
Development

No branches or pull requests

2 participants