@@ -12,7 +12,7 @@ This will depend on the nature of the change and what you want to exercise.
12
12
Here are some rough guidelines:
13
13
14
14
- The majority of compiler tests are done with [ compiletest] .
15
- - The majority of compiletest tests are [ UI] ( ui.md ) tests in the [ ` src/test /ui` ] directory.
15
+ - The majority of compiletest tests are [ UI] ( ui.md ) tests in the [ ` tests /ui` ] directory.
16
16
- Changes to the standard library are usually tested within the standard library itself.
17
17
- The majority of standard library tests are written as doctests,
18
18
which illustrate and exercise typical API behavior.
@@ -30,7 +30,7 @@ Here are some rough guidelines:
30
30
- Check out the [ compiletest] chapter for more specialized test suites.
31
31
32
32
[ compiletest ] : compiletest.md
33
- [ `src/test/ ui` ] : https://github.com/rust-lang/rust/tree/master/src/test /ui/
33
+ [ `tests/ ui` ] : https://github.com/rust-lang/rust/tree/master/tests /ui/
34
34
35
35
## UI test walkthrough
36
36
@@ -41,13 +41,13 @@ For this tutorial, we'll be adding a test for an async error message.
41
41
### Step 1. Add a test file
42
42
43
43
The first step is to create a Rust source file somewhere in the
44
- [ ` src/test /ui` ] tree.
44
+ [ ` tests /ui` ] tree.
45
45
When creating a test, do your best to find a good location and name (see [ Test
46
46
organization] ( ui.md#test-organization ) for more).
47
47
Since naming is the hardest part of development, everything should be downhill
48
48
from here!
49
49
50
- Let's place our async test at ` src/test /ui/async-await/await-without-async.rs` :
50
+ Let's place our async test at ` tests /ui/async-await/await-without-async.rs` :
51
51
52
52
``` rust,ignore
53
53
// Check what happens when using await in a non-async fn.
@@ -84,17 +84,17 @@ The next step is to create the expected output from the compiler.
84
84
This can be done with the ` --bless ` option:
85
85
86
86
``` sh
87
- ./x.py test src/test /ui/async-await/await-without-async.rs --bless
87
+ ./x.py test tests /ui/async-await/await-without-async.rs --bless
88
88
```
89
89
90
90
This will build the compiler (if it hasn't already been built), compile the
91
91
test, and place the output of the compiler in a file called
92
- ` src/test /ui/async-await/await-without-async.stderr` .
92
+ ` tests /ui/async-await/await-without-async.stderr` .
93
93
94
94
However, this step will fail!
95
95
You should see an error message, something like this:
96
96
97
- > error: /rust/src/test /ui/async-await/await-without-async.rs:7: unexpected
97
+ > error: /rust/tests /ui/async-await/await-without-async.rs:7: unexpected
98
98
> error: '7:10: 7:16: ` await ` is only allowed inside ` async ` functions and
99
99
> blocks E0728'
100
100
@@ -118,7 +118,7 @@ annotations](ui.md#error-annotations) section).
118
118
Save that, and run the test again:
119
119
120
120
``` sh
121
- ./x.py test src/test /ui/async-await/await-without-async.rs
121
+ ./x.py test tests /ui/async-await/await-without-async.rs
122
122
```
123
123
124
124
It should now pass, yay!
@@ -131,7 +131,7 @@ If you are adding a new diagnostic message, now would be a good time to
131
131
also consider how readable the message looks overall, particularly for
132
132
people new to Rust.
133
133
134
- Our example ` src/test /ui/async-await/await-without-async.stderr` file should
134
+ Our example ` tests /ui/async-await/await-without-async.stderr` file should
135
135
look like this:
136
136
137
137
``` text
@@ -166,7 +166,7 @@ The final step before posting a PR is to check if you have affected anything els
166
166
Running the UI suite is usually a good start:
167
167
168
168
``` sh
169
- ./x.py test src/test /ui
169
+ ./x.py test tests /ui
170
170
```
171
171
172
172
If other tests start failing, you may need to investigate what has changed
0 commit comments