foresterre / foresterre/parameterized

Consider adding a variant which inverses the declaration by being case by case

Open
#29 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
27
Forks
2
PR merge metrics
No merged PRs in 30d

Description

Current:
```rust
#[parameterized(
text = {
"aaa",
"bab",
"😃bc"
},
expected = {
'a',
'b',
'😃'
}
)]
fn test_peek_first_chars(text: &str, expected: char) {
assert_eq!(text.peek_first(), expected);
}
```

declared case by case:

```rust
#[parameterized'(
triple_a = {
"aaa",
'a',
},
bab = {
"bab",
'b',
},
emoji = {
text: "😃ab", // optionally named, but original order should be preserved for consistency
expected: '😃'
}
)]
fn test_peek_first_chars(text: &str, expected: char) {
assert_eq!(text.peek_first(), expected);
}
```

Advantages
* trivial to define test case naming
* potentially declaring a lot of test argument identifiers on test case declaration (that's why making them optional is a good idea I think)

Disadvantages:
* similar test case data spread out more
* potentially huge attribute declarations, with nesting which makes it potentially harder to read

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.