Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
inquisitivecrystal committed Jan 4, 2022
1 parent 50656c8 commit ae92083
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/ui/meta/cfg-ignore-with-target.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This test checks that the "ignore-cfg" compiletest option is evaluated
// based on the "--target" option in "compile-flags", rather than
// the default platform.
//
// compile-flags: --target x86_64-unknown-linux-gnu
// needs-llvm-components: x86
// ignore-cfg: target_os=linux
// check-pass

compile_error!("this should never be compiled");

fn main() {}
10 changes: 10 additions & 0 deletions src/test/ui/meta/cfg-ignore.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This test checks that the "ignore-cfg" compiletest option matches
// up with rustc's builtin evaluation of cfgs.
//
// ignore-cfg: target_family=unix
// check-pass

#[cfg(target_family = "unix")]
compile_error!("this shouldn't be compiled on unix");

fn main() {}
10 changes: 10 additions & 0 deletions src/test/ui/meta/cfg-only.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This test checks that the "ignore-cfg" compiletest option matches
// up with rustc's builtin evaluation of cfgs.
//
// only-cfg: target_family=unix
// check-pass

#[cfg(not(target_family = "unix"))]
compile_error!("this should only be compiled on unix");

fn main() {}

0 comments on commit ae92083

Please sign in to comment.