Skip to content

Update documentation for current tests requirements #2531

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 1 commit into from
Aug 2, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/appendix/humorust.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
What's a project without a sense of humor? And frankly some of these are
enlightening?

- [Weird exprs test](https://github.com/rust-lang/rust/blob/master/tests/ui/weird-exprs.rs)
- [Weird exprs test](https://github.com/rust-lang/rust/blob/master/tests/ui/expr/weird-exprs.rs)
- [Ferris Rap](https://fitzgen.com/2018/12/13/rust-raps.html)
- [The Genesis of Generic Germination](https://github.com/rust-lang/rust/pull/53645#issue-210543221)
- [The Bastion of the Turbofish test](https://github.com/rust-lang/rust/blob/79d8a0fcefa5134db2a94739b1d18daa01fc6e9f/src/test/ui/bastion-of-the-turbofish.rs)
Expand Down
2 changes: 1 addition & 1 deletion src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ described below:
- Example: `x86_64-unknown-linux-gnu`

See
[`tests/ui/commandline-argfile.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui/argfile/commandline-argfile.rs)
[`tests/ui/argfile/commandline-argfile.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui/argfile/commandline-argfile.rs)
for an example of a test that uses this substitution.

[output normalization]: ui.md#normalization
Expand Down
8 changes: 3 additions & 5 deletions src/tests/ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ If you need to work with `#![no_std]` cross-compiling tests, consult the

## General structure of a test

A test consists of a Rust source file located anywhere in the `tests/ui`
directory, but they should be placed in a suitable sub-directory. For example,
[`tests/ui/hello.rs`] is a basic hello-world test.
A test consists of a Rust source file located in the `tests/ui` directory.
**Tests must be placed in the appropriate subdirectory** based on their purpose
and testing category - placing tests directly in `tests/ui` is not permitted.

Compiletest will use `rustc` to compile the test, and compare the output against
the expected output which is stored in a `.stdout` or `.stderr` file located
Expand All @@ -46,8 +46,6 @@ pass/fail expectations](#controlling-passfail-expectations).
By default, a test is built as an executable binary. If you need a different
crate type, you can use the `#![crate_type]` attribute to set it as needed.

[`tests/ui/hello.rs`]: https://github.com/rust-lang/rust/blob/master/tests/ui/hello.rs

## Output comparison

UI tests store the expected output from the compiler in `.stderr` and `.stdout`
Expand Down