feat: support outer doc comments for naming matrix tests#321
feat: support outer doc comments for naming matrix tests#321la10736 merged 1 commit intola10736:masterfrom
Conversation
|
Ok, it looks fine as POC. Just a note about description, I prefer something like Of course, both unit and integration tests are missed, but it's a POC. Last note: I'm on vacation till Jul 21th, so I can't review this PR till this date. Thx |
38aa283 to
bf4da40
Compare
Good point, updated the PR! I added an additional parameter to Let me know if this solution is good enough!
I added an unit test in the
All good, no rush :) |
There was a problem hiding this comment.
First of all thanks very much for your effort and please apologize me for my late review.
You had implement the parser just for the older and deprecated syntax https://docs.rs/rstest/latest/rstest/attr.rstest.html#old-compact-syntax but not for the newer one https://docs.rs/rstest/latest/rstest/attr.rstest.html#values-lists . Moreover you introduced a silly bug (maybe I should write an integration test for it).
Here a todo list
- Fix legacy parser
- Implement the parser for the newer syntax too (with some test unit)
- Add integration tests: expand
matrix::use_args_attributesinrstest/tests/rstest/mod.rsfor the newer syntax andmatrix::happy_pathfor the older. - Modify `#[values] documentation (just for the newer syntax is enough)
- Add a line in changelog file
8b542af to
1220107
Compare
|
I addressed the feedback, please have a look again! |
1220107 to
dbe095f
Compare
la10736
left a comment
There was a problem hiding this comment.
It's a great job but two more things:
- I would have test for both case: with and without doc comments
- I guess that the changes to
sanitize_identare not necessary (add a boolean flag to a function is often far than the best). Can you try my proposed solution?
8df3567 to
5368d61
Compare
|
Thanks for the review. Made the changes, please have a look! |
la10736
left a comment
There was a problem hiding this comment.
Great Job!! Thanks a Lot. Just last small thing: change the changelog not from change to add
Adds support for using outer doc comments (`///`) instead of
auto-generated tests names for parameterized matrix tests.
e.g. legacy compact syntax:
```rust
expected => [
/// forty_two
42,
/// four
2*3-2,
],
)]
fn test(expected: usize) { ... }
```
e.g. attribute syntax:
```rust
fn test(
#[values(
/// forty_two
42,
/// four
2*3-2,
)]
expected: usize,
) { ... }
```
The generated test names will be `values_1_len_forty_two` and
`values_2_len_four`.
Fixes <la10736#320>
Signed-off-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
5368d61 to
e588c39
Compare
|
all done! |
Adds support for using outer doc comments (
///) instead ofauto-generated tests names for parameterized matrix tests.
e.g. legacy compact syntax:
e.g. attribute syntax:
The generated test names will be
values_1_len_forty_twoandvalues_2_len_four.Fixes #320