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
I would like the possibility of passing flags to cargo in macrotest::expand_without_refresh.
My use case is that I would like to test my expansion with different crate features. It seems to me that macrotest::expand_without_refresh simply calls cargo expand, which means the default features of the crate under test are used.
I would like to be able to disable the default features and enable other features in a granular fashion:
// Test expansion without any features
macrotest::expand_without_refresh("some_test_file.rs", "--no-default-features");
// Test expansion with only feature "some_feature" enabled
macrotest::expand_without_refresh("some_test_file.rs", "--features some_feature");
Of course the exact API doesn't have to look like the above.
The text was updated successfully, but these errors were encountered:
@Emoun this feature was implemented in #46. Feel free to pull this branch and test the new API against your requirements.
Example from tests that enables test-feature during macro expansion:
#[test]pubfnpass_args(){
macrotest::expand_args("tests/expand_args/*.rs",&["--features","test-feature"]);}#[test]pubfnpass_expect_expanded_args(){// If you delete one of the `.expanded.rs` files, this test will fail.
macrotest::expand_args("tests/expand_args/*.rs",&["--features","test-feature"]);}#[test]#[should_panic]pubfnfail_expect_expanded_args(){// This directory doesn't have expanded files but since they're expected, the test will fail.
macrotest::expand_without_refresh_args("tests/no_expanded_args/*.rs",&["--features","test-feature"]);}
@eupn I have tested the branch and it seems to work as I expected. Note that I have only tested macrotest::expand_without_refresh_args, as that is the only one I can make use of.
I look forward to seeing this in a future release.
I would like the possibility of passing flags to cargo in
macrotest::expand_without_refresh
.My use case is that I would like to test my expansion with different crate features. It seems to me that
macrotest::expand_without_refresh
simply callscargo expand
, which means the default features of the crate under test are used.I would like to be able to disable the default features and enable other features in a granular fashion:
Of course the exact API doesn't have to look like the above.
The text was updated successfully, but these errors were encountered: