Skip to content

Commit 1ccd36e

Browse files
committed
Address feedback
- Mention test filtering - Remove restriction that `NAME` be a valid identifier - Rename IDENT to NAME
1 parent 78f4c1d commit 1ccd36e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

text/0000-doctest-name.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ doctests, it is hard to identify which doctest is which in the test runner
1818
output by line number alone.
1919

2020
By giving users the option to give names to doctests, identifying individual
21-
doctests in test runner output will be easier.
21+
doctests in test runner output will be easier. Additionally, users could re-run
22+
specific tests using `cargo test --doc -- $TEST_NAME`.
2223

2324
# Guide-level explanation
2425
[guide-level-explanation]: #guide-level-explanation
@@ -53,7 +54,6 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
5354
If you'd like to have the test runner print a more informative name, perhaps
5455
because there are many doctests in a single file, you can put `name=NAME`,
5556
where `NAME` is the name the test should have, in the doctest's info string.
56-
`NAME` should be a valid Rust identifer.
5757

5858

5959
````rust
@@ -77,18 +77,18 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
7777
[reference-level-explanation]: #reference-level-explanation
7878

7979
The set of valid words that may appear in code block info strings is extended
80-
to include patterns of the form `name=IDENT`.
80+
to include patterns of the form `name=NAME`.
8181

82-
This `IDENT` will be the name of the documentation test generated by the code
82+
This `NAME` will be the name of the documentation test generated by the code
8383
block.
8484

8585
When the test runner runs the documentation test, the test will be identified
8686
by this name, in addition to the test binary, module, and line number.
8787

88-
Multiple `name=IDENT` words may not appear in a single code block's info
88+
Multiple `name=NAME` words may not appear in a single code block's info
8989
string.
9090

91-
`name=IDENT` may be combined with existing annotations like `rust` or
91+
`name=NAME` may be combined with existing annotations like `rust` or
9292
`should_panic` by separating the annotations with commas:
9393

9494
````
@@ -129,7 +129,8 @@ little hard to make sense of.
129129
# Prior art
130130
[prior-art]: #prior-art
131131

132-
None.
132+
Unit and integration tests have names. This change would bring doctests closer
133+
to parity, by allowing features like test filtering to work with doctests.
133134

134135
# Unresolved questions
135136
[unresolved-questions]: #unresolved-questions

0 commit comments

Comments
 (0)