Closed lemunozm closed 3 years ago
I think what you are looking for is rust built-in cfg_attr
. https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute . Test-case itself doesn't support conditional compilation.
Example:
#[cfg_attr(feature_type_a, test_case(TypeA))]
Does that help?
That's just what I want!
My knowledge of this part of rust is very limited.
Thanks a lot for your answer!
Hi,
I am in a situation where my test case only must be compiled if some rust feature is enabled:
The problem with the above code is that the
cfg
is set for the entire function (all cases). Iffeature_type_a
is not enabled, the function do_stuff does not exist, but I want that it exists forTypeB
. Is there any way to pass acfg
or afeature
into atest_case
? Something like:#[test_case(features = "feature_type_a", TypeA)]
Thank you so much!