Skip to content

Improve instructions for adding a new test #881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/tests/adding.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down