Skip to content

Commit 00b595a

Browse files
committed
Address review comments
- Say what should be considered a library test - Mention adding error numbers to doc tests - Link to #ui section - Line wrapping
1 parent a5d3ff8 commit 00b595a

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/tests/adding.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,25 @@ rough heuristics:
2929
- need to run gdb or lldb? use the `debuginfo` test suite
3030
- need to inspect LLVM IR or MIR IR? use the `codegen` or `mir-opt` test
3131
suites
32-
- need to run rustdoc? Prefer a `rustdoc` or `rustdoc-ui` test. Occasionally you'll need `rustdoc-js` as well.
32+
- need to run rustdoc? Prefer a `rustdoc` or `rustdoc-ui` test.
33+
Occasionally you'll need `rustdoc-js` as well.
3334
- 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`).
35-
- For most other things, [a `ui` (or `ui-fulldeps`) test](#ui) is to be
36-
preferred:
37-
- `ui` tests subsume both `run-pass`, `compile-fail`, and `parse-fail` tests
35+
- Library tests should go in `library/${crate}/tests` (where `${crate}` is
36+
usually `core`, `alloc`, or `std`). Library tests include:
37+
- tests that an API behaves properly, including accepting various types or
38+
having some runtime behavior
39+
- tests where any compiler warnings are not relevant to the test
40+
- tests that a use of an API gives a compile error, where the exact error
41+
message is not relevant to the test. These should have an
42+
[error number](`E0XXX`) in the code block to make sure it's the correct error.
43+
- For most other things, [a `ui` (or `ui-fulldeps`) test](#ui) is to be preferred:
44+
- [`ui`](#ui) tests subsume both `run-pass`, `compile-fail`, and `parse-fail` tests
3845
- in the case of warnings or errors, `ui` tests capture the full output,
3946
which makes it easier to review but also helps prevent "hidden" regressions
4047
in the output
4148

49+
[error number]: https://doc.rust-lang.org/rustdoc/unstable-features.html#error-numbers-for-compile-fail-doctests
50+
4251
## Naming your test
4352

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

0 commit comments

Comments
 (0)