Skip to content

Commit 7b7b4d7

Browse files
committed
Require an @ in front of all commands.
1 parent 655228a commit 7b7b4d7

File tree

12 files changed

+27
-30
lines changed

12 files changed

+27
-30
lines changed

src/header.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -435,23 +435,20 @@ fn iter_header(testfile: &Path, cfg: Option<&str>, it: &mut dyn FnMut(&str)) {
435435
let ln = ln.trim();
436436
if ln.starts_with("fn") || ln.starts_with("mod") {
437437
return;
438-
} else if ln.starts_with("//[") {
438+
} else if let Some(ln) = ln.strip_prefix("//@[") {
439439
// A comment like `//[foo]` is specific to revision `foo`
440-
if let Some(close_brace) = ln.find(']') {
441-
let lncfg = &ln[3..close_brace];
442-
let matches = match cfg {
443-
Some(s) => s == &lncfg[..],
444-
None => false,
445-
};
446-
if matches {
447-
it(ln[(close_brace + 1) ..].trim_start());
440+
if let Some((lncfg, ln)) = ln.split_once(']') {
441+
if cfg == Some(lncfg) {
442+
it(ln.trim_start());
448443
}
449444
} else {
450-
panic!("malformed condition directive: expected `//[foo]`, found `{}`",
451-
ln)
445+
panic!(
446+
"malformed condition directive: expected `//[foo]`, found `{}`",
447+
ln
448+
)
452449
}
453-
} else if ln.starts_with("//") {
454-
it(ln[2..].trim_start());
450+
} else if let Some(ln) = ln.strip_prefix("//@") {
451+
it(ln.trim_start());
455452
}
456453
}
457454
return;

test-project/tests/assembly/panic.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// assembly-output: emit-asm
2-
// compile-flags: --crate-type rlib
1+
//@assembly-output: emit-asm
2+
//@compile-flags: --crate-type rlib
33
#![no_std]
44

55
#[no_mangle]
66
fn panic_fun() -> u32 {
77
// CHECK-LABEL: panic_fun:
88
// CHECK: ud2
99
panic!();
10-
}
10+
}

test-project/tests/nightly/2018-edition.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// edition:2018
2-
// compile-pass
1+
//@edition:2018
2+
//@compile-pass
33

44
pub struct Foo;
55
impl Foo {

test-project/tests/nightly/auxiliary/simple_proc_macro.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// no-prefer-dynamic
1+
//@no-prefer-dynamic
22

33
#![crate_type = "proc-macro"]
44

test-project/tests/nightly/some-proc-macro.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// run-pass
2-
// aux-build:simple_proc_macro.rs
1+
//@run-pass
2+
//@aux-build:simple_proc_macro.rs
33

44
#![feature(proc_macro_hygiene)]
55

test-project/tests/pretty/macro.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// pretty-compare-only
2-
// pretty-mode:expanded
3-
// pp-exact:macro.pp
1+
//@pretty-compare-only
2+
//@pretty-mode:expanded
3+
//@pp-exact:macro.pp
44

55
macro_rules! square {
66
($x:expr) => {

test-project/tests/run-fail/args-panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111

12-
// error-pattern:meep
12+
//@error-pattern:meep
1313

1414
#![allow(unknown_features)]
1515
#![feature(box_syntax)]

test-project/tests/run-fail/issue-20971.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Regression test for Issue #20971.
1212

13-
// error-pattern:Hello, world!
13+
//@error-pattern:Hello, world!
1414

1515
pub trait Parser {
1616
type Input;

test-project/tests/run-fail/match-wildcards.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:squirrelcupcake
11+
//@error-pattern:squirrelcupcake
1212
fn cmp() -> int {
1313
match (Some('a'), None::<char>) {
1414
(Some(_), _) => { panic!("squirrelcupcake"); }

test-project/tests/run-fail/mod-zero.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:attempted remainder with a divisor of zero
11+
//@error-pattern:attempted remainder with a divisor of zero
1212
fn main() {
1313
let y = 0;
1414
let _z = 1 % y;

test-project/tests/ui/dyn-keyword.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// run-rustfix
11+
//@run-rustfix
1212

1313
#![allow(unused_variables)]
1414
#![deny(keyword_idents)]

test-project/tests/ui/dyn-keyword.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// run-rustfix
11+
//@run-rustfix
1212

1313
#![allow(unused_variables)]
1414
#![deny(keyword_idents)]

0 commit comments

Comments
 (0)