Skip to content

Commit ba9995f

Browse files
jieyouxuoli-obk
authored andcommitted
Add basic UI test docs on legacy compiletest-style headers vs ui_test-style headers
1 parent 5c04ed2 commit ba9995f

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/ui/README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# UI Tests
2+
3+
This folder contains `rustc`'s
4+
[UI tests](https://rustc-dev-guide.rust-lang.org/tests/ui.html).
5+
6+
## Test Directives (Headers)
7+
8+
Typically, a UI test will have some test directives / headers which are
9+
special comments that tell compiletest how to build and intepret a test.
10+
11+
As part of an on-going effort to rewrite compiletest
12+
(see <https://github.com/rust-lang/compiler-team/issues/536>), a major
13+
change proposal to change legacy compiletest-style headers `// <directive>`
14+
to [`ui_test`](https://github.com/oli-obk/ui_test)-style headers
15+
`//@ <directive>` was accepted (see
16+
<https://github.com/rust-lang/compiler-team/issues/512>.
17+
18+
An example directive is `ignore-test`. In legacy compiletest style, the header
19+
would be written as
20+
21+
```rs
22+
// ignore-test
23+
```
24+
25+
but in `ui_test` style, the header would be written as
26+
27+
```rs
28+
//@ ignore-test
29+
```
30+
31+
compiletest is changed to accept only `//@` directives for UI tests
32+
(currently), and will reject and report an error if it encounters any
33+
comments `// <content>` that may be parsed as an legacy compiletest-style
34+
test header. To fix this, you should migrate to the `ui_test`-style header
35+
`//@ <content>`.

0 commit comments

Comments
 (0)