It seems the test_case attribute can only work as a hack of the built-in test framework rather than an "honest" attribute macro.
In particular, this fails:
use test_case::test_case as parametric_test;
#[parametric_test(1 ; "one")]
#[parametric_test(2 ; "two")]
#[parametric_test(3 ; "three")]
fn test_blubbi(x: u32) {
}
The built-in use of test_case is not documented and should probably be treated as unstable. The built-in attribute certainly is unstable, so overriding it with use test_case::test_case is a hack that is liable to stop working in any future release of Rust.
Also, this does not work as intended:
use test_case::test_case;
mod foo {
use super::*;
#[test_case(1 ; "one")]
#[test_case(2 ; "two")]
#[test_case(3 ; "three")]
fn test_blubbi(x: u32) {
// test logic that uses x: {1,2,3} * T: {Foo, Bar} thus 6 test cases in total
}
}
This impedes interoperability with another boilerplate-reducing solution for tests: mzabaluev/generic-tests#6
It seems the
test_caseattribute can only work as a hack of the built-in test framework rather than an "honest" attribute macro.In particular, this fails:
The built-in use of
test_caseis not documented and should probably be treated as unstable. The built-in attribute certainly is unstable, so overriding it withuse test_case::test_caseis a hack that is liable to stop working in any future release of Rust.Also, this does not work as intended:
This impedes interoperability with another boilerplate-reducing solution for tests: mzabaluev/generic-tests#6