Parse '-' in numeric values used in test case
- Dominant language
- Rust
- Stars
- 633
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
For:
#[test_case(15, 15)]
#[test_case(-15, 15)]
```rust
fn test_abs(value: f64, expected: f64) {
assert_eq!(value.abs(), expected)
}
```
We get error:
> error[E0428]: the name `_15_15` is defined multiple times
> --> src/test.rs
> |
> | #[test_case(15, 15)]
> | ^^^^^^^^^^^^^^^^^^^^
> | |
> | previous definition of the value `_15_15` here
> | `_15_15` redefined here
> |
> = note: `_15_15` must be defined only once in the value namespace of this mod
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the issue with the shown #[test_case] attributes and test_abs example, then trace the test_case procedural macro's handling of numeric arguments and generated names. Done means negative and positive numeric values compile without duplicate-name errors and the generated tests both run with the expected assertions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100