changed to relative links, where possible
This commit is contained in:
parent
3d7bc934db
commit
b84288f2ac
|
|
@ -7,28 +7,27 @@ configure behavior and expected results of both individual and groups of tests.
|
||||||
`compiletest` tests may check test code for success, for failure or in some cases, even failure to compile. Tests are
|
`compiletest` tests may check test code for success, for failure or in some cases, even failure to compile. Tests are
|
||||||
typically organized as a Rust source file with annotations in comments before and/or within the test code, which serve to
|
typically organized as a Rust source file with annotations in comments before and/or within the test code, which serve to
|
||||||
direct `compiletest` on if or how to run the test, what behavior to expect, and more. If you are unfamiliar with the compiler
|
direct `compiletest` on if or how to run the test, what behavior to expect, and more. If you are unfamiliar with the compiler
|
||||||
testing framework, see [`this chapter`](https://github.com/rust-lang-nursery/rustc-guide/blob/master/src/tests/intro.md) for additional background.
|
testing framework, see [`this chapter`](./tests/intro.html) for additional background.
|
||||||
|
|
||||||
The tests themselves are typically (but not always) organized into "suites"--for example, `run-pass`, a folder
|
The tests themselves are typically (but not always) organized into "suites"--for example, `run-pass`, a folder
|
||||||
representing tests that should succeed, `run-fail`, a folder holding tests that should compile successfully, but return
|
representing tests that should succeed, `run-fail`, a folder holding tests that should compile successfully, but return
|
||||||
a failure (non-zero status), `compile-fail`, a folder holding tests that should fail to compile, and many more. The various
|
a failure (non-zero status), `compile-fail`, a folder holding tests that should fail to compile, and many more. The various
|
||||||
suites are defined in [src/tools/compiletest/src/common.rs](https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/common.rs) in the `pub struct Config` declaration. And a very good
|
suites are defined in [src/tools/compiletest/src/common.rs](https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/common.rs) in the `pub struct Config` declaration. And a very good
|
||||||
introduction to the different suites of compiler tests along with details about them can be found
|
introduction to the different suites of compiler tests along with details about them can be found in [`Adding new tests`](./tests/adding.html).
|
||||||
in [`Adding new tests`](https://github.com/rust-lang-nursery/rustc-guide/blob/master/src/tests/adding.md).
|
|
||||||
|
|
||||||
## Adding a new test file
|
## Adding a new test file
|
||||||
Briefly, simply create your new test in the appropriate location under [src/test](https://github.com/rust-lang/rust/tree/master/src/test). No registration of test files is necessary as
|
Briefly, simply create your new test in the appropriate location under [src/test](https://github.com/rust-lang/rust/tree/master/src/test). No registration of test files is necessary as
|
||||||
`compiletest` will scan the [src/test](https://github.com/rust-lang/rust/tree/master/src/test) subfolder recursively, and will execute any Rust source files it finds as tests.
|
`compiletest` will scan the [src/test](https://github.com/rust-lang/rust/tree/master/src/test) subfolder recursively, and will execute any Rust source files it finds as tests.
|
||||||
See [`Adding new tests`](https://github.com/rust-lang-nursery/rustc-guide/blob/master/src/tests/adding.md) for a complete guide on how to adding new tests.
|
See [`Adding new tests`](./tests/adding.html) for a complete guide on how to adding new tests.
|
||||||
|
|
||||||
## Header Commands
|
## Header Commands
|
||||||
Source file annotations which appear in comments near the top of the source file *before* any test code are known as header
|
Source file annotations which appear in comments near the top of the source file *before* any test code are known as header
|
||||||
commands. These commands can instruct `compiletest` to ignore this test, set expectations on whether it is expected to
|
commands. These commands can instruct `compiletest` to ignore this test, set expectations on whether it is expected to
|
||||||
succeed at compiling, or what the test's return code is expected to be. Header commands (and their inline counterparts,
|
succeed at compiling, or what the test's return code is expected to be. Header commands (and their inline counterparts,
|
||||||
Error Info commands) are described more fully [here](https://github.com/rust-lang-nursery/rustc-guide/blob/master/src/tests/adding.md#header-commands-configuring-rustc).
|
Error Info commands) are described more fully [here](./tests/adding.html#header-commands-configuring-rustc).
|
||||||
|
|
||||||
### Adding a new header command
|
### Adding a new header command
|
||||||
Header commands are defined in the `TestProps` struct in [src/tools/compiletest/src/header.rs](https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/header.rs). At a high level, there are dozens of test properties are defined here, all set to default values in the `TestProp` struct's `impl` block. Any test can override this
|
Header commands are defined in the `TestProps` struct in [src/tools/compiletest/src/header.rs](https://github.com/rust-lang/rust/tree/master/src/tools/compiletest/src/header.rs). At a high level, there are dozens of test properties defined here, all set to default values in the `TestProp` struct's `impl` block. Any test can override this
|
||||||
default value by specifying the property in question as header command as a comment (`//`) in the test source file, before any source code.
|
default value by specifying the property in question as header command as a comment (`//`) in the test source file, before any source code.
|
||||||
|
|
||||||
#### Using a header command
|
#### Using a header command
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue