Revise test naming advice to discourage using issue numbers alone
But accept test names that include non-prefix issue number.
This commit is contained in:
parent
e4eded33df
commit
58aeefcf0c
|
|
@ -17,7 +17,8 @@ test that makes the life of another contributor as hard as possible.
|
||||||
>
|
>
|
||||||
> To make the life of another contributor as hard as possible, one might:
|
> To make the life of another contributor as hard as possible, one might:
|
||||||
>
|
>
|
||||||
> - Only name the test after an issue, e.g. `issue-123456.rs`.
|
> - Name the test after an issue number alone without any other context, e.g.
|
||||||
|
> `issue-123456.rs`.
|
||||||
> - Have no comments at all on what the test is trying to exercise, no links to
|
> - Have no comments at all on what the test is trying to exercise, no links to
|
||||||
> relevant context.
|
> relevant context.
|
||||||
> - Include a test that is massive (that can otherwise be minimized) and
|
> - Include a test that is massive (that can otherwise be minimized) and
|
||||||
|
|
@ -40,23 +41,28 @@ related tests.
|
||||||
|
|
||||||
- Name the test after what it's trying to exercise or prevent regressions of.
|
- Name the test after what it's trying to exercise or prevent regressions of.
|
||||||
- Keep it concise.
|
- Keep it concise.
|
||||||
- Avoid including issue numbers in test names.
|
- Avoid using issue numbers alone as test names.
|
||||||
|
- Avoid starting the test name with `issue-xxxxx` prefix as it degrades
|
||||||
|
auto-completion.
|
||||||
|
|
||||||
> **Avoid issue numbers in test names**
|
> **Avoid using only issue numbers as test names**
|
||||||
>
|
>
|
||||||
> Prefer including them as links or `#123456` in test comments instead.
|
> Prefer including them as links or `#123456` in test comments instead. Or if it
|
||||||
|
> makes sense to include the issue number, also include brief keywords like
|
||||||
|
> `macro-external-span-ice-123956.rs`.
|
||||||
>
|
>
|
||||||
> ```text
|
> ```text
|
||||||
> tests/ui/typeck/issue-123456.rs // bad
|
> tests/ui/typeck/issue-123456.rs // bad
|
||||||
> tests/ui/typeck/issue-123456-asm-macro-external-span-ice.rs // bad
|
> tests/ui/typeck/issue-123456-asm-macro-external-span-ice.rs // bad (for tab completion)
|
||||||
|
> tests/ui/typeck/asm-macro-external-span-ice-123456.rs // good
|
||||||
> tests/ui/typeck/asm-macro-external-span-ice.rs // good
|
> tests/ui/typeck/asm-macro-external-span-ice.rs // good
|
||||||
> ```
|
> ```
|
||||||
>
|
>
|
||||||
> `issue-123456.rs` does not tell you immediately anything about what the test
|
> `issue-123456.rs` does not tell you immediately anything about what the test
|
||||||
> is actually exercising meaning you need to do additional searching. Including
|
> is actually exercising meaning you need to do additional searching. Including
|
||||||
> the issue number in the test name is really noisy for finding relevant tests
|
> the issue number in the test name as a prefix makes tab completion less useful
|
||||||
> by what they're exercising (if you `ls` a test directory and get a bunch of
|
> (if you `ls` a test directory and get a bunch of `issue-xxxxx` prefixes). We
|
||||||
> `issue-xxxxx` prefixes). We can link to the issue in a test comment.
|
> can link to the issue in a test comment.
|
||||||
>
|
>
|
||||||
> ```rs
|
> ```rs
|
||||||
> //! Check that `asm!` macro including nested macros that come from external
|
> //! Check that `asm!` macro including nested macros that come from external
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue