@rustlang question: I have a feature behind a feature flag, and I want to disable its tests when the feature flag is disabled. But it seems test modules don't see the feature flag attribute. Is there a way to conditionally compile out the tests based on the flag?
-
Show this thread
-
Replying to @littlecalculist @rustlang
#[test] #[cfg(feature = "whatever")] should be all you need. Can you elaborate on what you mean by test modules don't see the feature flag?
2 replies 0 retweets 1 like -
Also make sure you're passing --feature whatever to the cargo test command. Not enough to just build with that :)
1 reply 0 retweets 3 likes -
i used to forget this *alllll the time*
1 reply 0 retweets 2 likes
I wrote a horrible shell script for Diesel so I'd stop forgetting this
3:49 PM - 30 Jan 2020
0 replies
0 retweets
4 likes
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.