frondeus / frondeus/test-case

Test case macro should not rely on implementation details of the built-in test framework

Open
#131 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
633
Forks
42
PR merge metrics
No merged PRs in 30d

Description

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:

```rust
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:

```rust
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: https://github.com/mzabaluev/generic-tests/issues/6

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.