Skip to content

Commit 7b0ef5b

Browse files
jieyouxuNoratrieb
authored andcommitted
Update compiletest directives to be in ui_test style //@
1 parent a29bab8 commit 7b0ef5b

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

src/tests/compiletest.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ the current revision name.
160160
For example, this will run twice, simulating changing a function:
161161

162162
```rust,ignore
163-
// revisions: rpass1 rpass2
163+
//@ revisions: rpass1 rpass2
164164
165165
#[cfg(rpass1)]
166166
fn foo() {
@@ -224,11 +224,11 @@ breakpoint, launch the program, inspect a value, and check what the debugger
224224
prints:
225225

226226
```rust,ignore
227-
// compile-flags: -g
227+
//@ compile-flags: -g
228228
229-
// lldb-command: run
230-
// lldb-command: print foo
231-
// lldb-check: $0 = 123
229+
//@ lldb-command: run
230+
//@ lldb-command: print foo
231+
//@ lldb-check: $0 = 123
232232
233233
fn main() {
234234
let foo = 123;
@@ -480,7 +480,7 @@ There are two [headers](headers.md) to assist with that:
480480
The source file should be in a directory called `auxiliary` beside the test file.
481481

482482
```rust,ignore
483-
// aux-build: my-helper.rs
483+
//@ aux-build: my-helper.rs
484484
485485
extern crate my_helper;
486486
// ... You can use my_helper.
@@ -507,8 +507,8 @@ Place the proc-macro itself in a file like `auxiliary/my-proc-macro.rs`
507507
with the following structure:
508508

509509
```rust,ignore
510-
// force-host
511-
// no-prefer-dynamic
510+
//@ force-host
511+
//@ no-prefer-dynamic
512512
513513
#![crate_type = "proc-macro"]
514514
@@ -529,7 +529,7 @@ The `#![crate_type]` attribute is needed to specify the correct crate-type.
529529
Then in your test, you can build with `aux-build`:
530530

531531
```rust,ignore
532-
// aux-build: my-proc-macro.rs
532+
//@ aux-build: my-proc-macro.rs
533533
534534
extern crate my_proc_macro;
535535
@@ -545,7 +545,7 @@ Revisions allow a single test file to be used for multiple tests.
545545
This is done by adding a special header at the top of the file:
546546

547547
```rust,ignore
548-
// revisions: foo bar baz
548+
//@ revisions: foo bar baz
549549
```
550550

551551
This will result in the test being compiled (and tested) three times,
@@ -560,7 +560,7 @@ comment, like so:
560560

561561
```rust,ignore
562562
// A flag to pass in only for cfg `foo`:
563-
//[foo]compile-flags: -Z verbose
563+
//@[foo]compile-flags: -Z verbose
564564
565565
#[cfg(foo)]
566566
fn test_foo() {

src/tests/headers.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,23 @@ They must appear before the Rust source in the test.
88
They may also appear in Makefiles for [run-make tests](compiletest.md#run-make-tests).
99

1010
They are normally put after the short comment that explains the point of this test.
11-
Some test suites use `//@` to signal that a comment is a header, but most are still
12-
just using plain comments.
13-
For example, this test uses the `// compile-flags` command to specify a custom
11+
Compiletest test suites use `//@` to signal that a comment is a header.
12+
For example, this test uses the `//@ compile-flags` command to specify a custom
1413
flag to give to rustc when the test is compiled:
1514

1615
```rust,ignore
1716
// Test the behavior of `0 - 1` when overflow checks are disabled.
1817
19-
// compile-flags: -C overflow-checks=off
18+
//@ compile-flags: -C overflow-checks=off
2019
2120
fn main() {
2221
let x = 0 - 1;
2322
...
2423
}
2524
```
2625

27-
Header commands can be standalone (like `// run-pass`) or take a value (like
28-
`// compile-flags: -C overflow-checks=off`).
26+
Header commands can be standalone (like `//@ run-pass`) or take a value (like
27+
`//@ compile-flags: -C overflow-checks=off`).
2928

3029
## Header commands
3130

@@ -192,10 +191,10 @@ The following headers are generally available, and not specific to particular
192191
test suites.
193192

194193
* `compile-flags` passes extra command-line args to the compiler,
195-
e.g. `// compile-flags: -g` which forces debuginfo to be enabled.
194+
e.g. `//@ compile-flags: -g` which forces debuginfo to be enabled.
196195
* `run-flags` passes extra args to the test if the test is to be executed.
197196
* `edition` controls the edition the test should be compiled with
198-
(defaults to 2015). Example usage: `// edition:2018`.
197+
(defaults to 2015). Example usage: `//@ edition:2018`.
199198
* `failure-status` specifies the numeric exit code that should be expected for
200199
tests that expect an error.
201200
If this is not set, the default is 1.
@@ -239,7 +238,7 @@ For example, if you need to pass a compiler flag with a path to a specific
239238
file, something like the following could work:
240239

241240
```rust,ignore
242-
// compile-flags: --remap-path-prefix={{src-base}}=/the/src
241+
//@ compile-flags: --remap-path-prefix={{src-base}}=/the/src
243242
```
244243

245244
Where the sentinel `{{src-base}}` will be replaced with the appropriate path
@@ -285,8 +284,8 @@ also in [`src/tools/compiletest/src/header.rs`] (note that the `Config`
285284
struct's declaration block is found in [`src/tools/compiletest/src/common.rs`]).
286285
`TestProps`'s `load_from()` method will try passing the current line of text to
287286
each parser, which, in turn typically checks to see if the line begins with a
288-
particular commented (`//`) header command such as `// must-compile-successfully`
289-
or `// failure-status`. Whitespace after the comment marker is optional.
287+
particular commented (`//@`) header command such as `//@ must-compile-successfully`
288+
or `//@ failure-status`. Whitespace after the comment marker is optional.
290289

291290
Parsers will override a given header command property's default value merely by
292291
being specified in the test file as a header command or by having a parameter

0 commit comments

Comments
 (0)