Skip to content

Commit 07c047f

Browse files
authored
Address review comments
- Say what should be considered a library test - Mention adding error numbers to doc tests - Link to #ui section
1 parent a5d3ff8 commit 07c047f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/tests/adding.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,19 @@ rough heuristics:
3131
suites
3232
- need to run rustdoc? Prefer a `rustdoc` or `rustdoc-ui` test. Occasionally you'll need `rustdoc-js` as well.
3333
- need to inspect the resulting binary in some way? Then use `run-make`
34-
- Library tests should go in `library/$crate/tests` (where `$crate` is usually `core`, `alloc`, or `std`).
34+
- Library tests should go in `library/${crate}/tests` (where `${crate}` is usually `core`, `alloc`, or `std`). Library tests include:
35+
- tests that an API behaves properly, including accepting various types or having some runtime behavior
36+
- tests where any compiler warnings are not relevant to the test
37+
- tests that a use of an API gives a compile error, where the exact error message is not relevant to the test. These should have an [error number] (`E0XXX`) in the code block to make sure it's the correct error.
3538
- For most other things, [a `ui` (or `ui-fulldeps`) test](#ui) is to be
3639
preferred:
37-
- `ui` tests subsume both `run-pass`, `compile-fail`, and `parse-fail` tests
40+
- [`ui`](#ui) tests subsume both `run-pass`, `compile-fail`, and `parse-fail` tests
3841
- in the case of warnings or errors, `ui` tests capture the full output,
3942
which makes it easier to review but also helps prevent "hidden" regressions
4043
in the output
4144

45+
[error number]: https://doc.rust-lang.org/rustdoc/unstable-features.html#error-numbers-for-compile-fail-doctests
46+
4247
## Naming your test
4348

4449
We have not traditionally had a lot of structure in the names of

0 commit comments

Comments
 (0)