about summary refs log tree commit diff
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-02-05 13:27:47 +1100
committerZalathar <Zalathar@users.noreply.github.com>2024-02-23 11:27:38 +1100
commit36f298c93dcf339f787077b38dc6dd9b2a3bd285 (patch)
treef769faef7bb40ecc06928a7919cfafb175382257
parent397937d812852f9bbeb671005cb399dbcb357cde (diff)
downloadrust-36f298c93dcf339f787077b38dc6dd9b2a3bd285.tar.gz
rust-36f298c93dcf339f787077b38dc6dd9b2a3bd285.zip
Add some simple meta-tests for the handling of `filecheck` flags
-rw-r--r--tests/codegen/meta-filecheck/check-prefix.rs4
-rw-r--r--tests/codegen/meta-filecheck/msvc-prefix-bad.rs7
-rw-r--r--tests/codegen/meta-filecheck/msvc-prefix-good.rs7
-rw-r--r--tests/codegen/meta-filecheck/no-directives.rs5
-rw-r--r--tests/codegen/meta-filecheck/revision-prefix.rs8
5 files changed, 31 insertions, 0 deletions
diff --git a/tests/codegen/meta-filecheck/check-prefix.rs b/tests/codegen/meta-filecheck/check-prefix.rs
new file mode 100644
index 00000000000..98bec68627e
--- /dev/null
+++ b/tests/codegen/meta-filecheck/check-prefix.rs
@@ -0,0 +1,4 @@
+// Simple test that uses the default CHECK prefix and should always succeed.
+
+// CHECK: main
+fn main() {}
diff --git a/tests/codegen/meta-filecheck/msvc-prefix-bad.rs b/tests/codegen/meta-filecheck/msvc-prefix-bad.rs
new file mode 100644
index 00000000000..f9984c74e2a
--- /dev/null
+++ b/tests/codegen/meta-filecheck/msvc-prefix-bad.rs
@@ -0,0 +1,7 @@
+// This is exactly like `msvc-prefix-good.rs`, except that it should always fail.
+
+//@ should-fail
+
+// MSVC: text that should not match
+// NONMSVC: text that should not match
+fn main() {}
diff --git a/tests/codegen/meta-filecheck/msvc-prefix-good.rs b/tests/codegen/meta-filecheck/msvc-prefix-good.rs
new file mode 100644
index 00000000000..580d20d5438
--- /dev/null
+++ b/tests/codegen/meta-filecheck/msvc-prefix-good.rs
@@ -0,0 +1,7 @@
+// One of MSVC or NONMSVC should always be defined, so this test should pass.
+
+// (one of these should always be present)
+
+// MSVC: main
+// NONMSVC: main
+fn main() {}
diff --git a/tests/codegen/meta-filecheck/no-directives.rs b/tests/codegen/meta-filecheck/no-directives.rs
new file mode 100644
index 00000000000..2cab263604e
--- /dev/null
+++ b/tests/codegen/meta-filecheck/no-directives.rs
@@ -0,0 +1,5 @@
+// A test that doesn't include any filecheck directives should fail.
+
+//@ should-fail
+
+fn main() {}
diff --git a/tests/codegen/meta-filecheck/revision-prefix.rs b/tests/codegen/meta-filecheck/revision-prefix.rs
new file mode 100644
index 00000000000..431066e3acc
--- /dev/null
+++ b/tests/codegen/meta-filecheck/revision-prefix.rs
@@ -0,0 +1,8 @@
+// The current revision name is registered as a filecheck prefix.
+
+//@ revisions: GOOD BAD
+//@ [BAD] should-fail
+
+// GOOD: main
+// BAD: text that should not match
+fn main() {}