diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2020-09-19 19:40:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-19 23:40:17 +0000 |
| commit | 0d195f113bff1891bb27b961ff8bdfb4b0d2f44c (patch) | |
| tree | fa32717bb2fb8f3fbd7e5e853376fbe0fb6e14f7 /src/doc/rustc-dev-guide | |
| parent | 3fd9f3bd08f5d7d7dc841f9c44b5e5685885b1a8 (diff) | |
| download | rust-0d195f113bff1891bb27b961ff8bdfb4b0d2f44c.tar.gz rust-0d195f113bff1891bb27b961ff8bdfb4b0d2f44c.zip | |
Improve instructions for adding a new test (#881)
* Improve instructions for adding a new test - Add a section for library tests - Expand section on rustdoc tests * Address review comments - Say what should be considered a library test - Mention adding error numbers to doc tests - Link to #ui section - Line wrapping * Fix incorrect link It shouldn't have been a link in the first place. Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com> Co-authored-by: Yuki Okushi <huyuumi.dev@gmail.com>
Diffstat (limited to 'src/doc/rustc-dev-guide')
| -rw-r--r-- | src/doc/rustc-dev-guide/src/tests/adding.md | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/src/tests/adding.md b/src/doc/rustc-dev-guide/src/tests/adding.md index c88d5e81df6..acdc2fd251c 100644 --- a/src/doc/rustc-dev-guide/src/tests/adding.md +++ b/src/doc/rustc-dev-guide/src/tests/adding.md @@ -29,15 +29,25 @@ rough heuristics: - need to run gdb or lldb? use the `debuginfo` test suite - need to inspect LLVM IR or MIR IR? use the `codegen` or `mir-opt` test suites - - need to run rustdoc? Prefer a `rustdoc` test + - need to run rustdoc? Prefer a `rustdoc` or `rustdoc-ui` test. + Occasionally you'll need `rustdoc-js` as well. - need to inspect the resulting binary in some way? Then use `run-make` -- For most other things, [a `ui` (or `ui-fulldeps`) test](#ui) is to be - preferred: - - `ui` tests subsume both run-pass, compile-fail, and parse-fail tests +- Library tests should go in `library/${crate}/tests` (where `${crate}` is + usually `core`, `alloc`, or `std`). Library tests include: + - tests that an API behaves properly, including accepting various types or + having some runtime behavior + - tests where any compiler warnings are not relevant to the test + - 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. +- For most other things, [a `ui` (or `ui-fulldeps`) test](#ui) is to be preferred: + - [`ui`](#ui) tests subsume both `run-pass`, `compile-fail`, and `parse-fail` tests - in the case of warnings or errors, `ui` tests capture the full output, which makes it easier to review but also helps prevent "hidden" regressions in the output +[error number]: https://doc.rust-lang.org/rustdoc/unstable-features.html#error-numbers-for-compile-fail-doctests + ## Naming your test We have not traditionally had a lot of structure in the names of |
