1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
use run_make_support::{cwd, diff, rustc};
fn test_and_compare(test_name: &str, flag: &str, val: &str) {
let mut cmd = rustc();
let output = cmd.input("").arg("--crate-type=lib").arg(flag).arg(val).run_fail();
assert_eq!(output.stdout_utf8(), "");
diff()
.expected_file(format!("{test_name}.stderr"))
.actual_text("stderr", output.stderr_utf8())
.run();
}
fn main() {
// Verify that frontmatter isn't allowed in `--cfg` arguments.
// https://github.com/rust-lang/rust/issues/146130
test_and_compare(
"cfg-frontmatter",
"--cfg",
r#"---
---
key"#,
);
// Verify that frontmatter isn't allowed in `--check-cfg` arguments.
// https://github.com/rust-lang/rust/issues/146130
test_and_compare(
"check-cfg-frontmatter",
"--check-cfg",
r#"---
---
cfg(key)"#,
);
// Verify that shebang isn't allowed in `--cfg` arguments.
test_and_compare(
"cfg-shebang",
"--cfg",
r#"#!/usr/bin/shebang
key"#,
);
// Verify that shebang isn't allowed in `--check-cfg` arguments.
test_and_compare(
"check-cfg-shebang",
"--check-cfg",
r#"#!/usr/bin/shebang
cfg(key)"#,
);
}
|