Skip to content

Commit ae92083

Browse files
Add tests
1 parent 50656c8 commit ae92083

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This test checks that the "ignore-cfg" compiletest option is evaluated
2+
// based on the "--target" option in "compile-flags", rather than
3+
// the default platform.
4+
//
5+
// compile-flags: --target x86_64-unknown-linux-gnu
6+
// needs-llvm-components: x86
7+
// ignore-cfg: target_os=linux
8+
// check-pass
9+
10+
compile_error!("this should never be compiled");
11+
12+
fn main() {}

src/test/ui/meta/cfg-ignore.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test checks that the "ignore-cfg" compiletest option matches
2+
// up with rustc's builtin evaluation of cfgs.
3+
//
4+
// ignore-cfg: target_family=unix
5+
// check-pass
6+
7+
#[cfg(target_family = "unix")]
8+
compile_error!("this shouldn't be compiled on unix");
9+
10+
fn main() {}

src/test/ui/meta/cfg-only.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// This test checks that the "ignore-cfg" compiletest option matches
2+
// up with rustc's builtin evaluation of cfgs.
3+
//
4+
// only-cfg: target_family=unix
5+
// check-pass
6+
7+
#[cfg(not(target_family = "unix"))]
8+
compile_error!("this should only be compiled on unix");
9+
10+
fn main() {}

0 commit comments

Comments
 (0)