about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorPietro Albini <pietro.albini@ferrous-systems.com>2022-10-24 09:56:05 +0200
committerPietro Albini <pietro.albini@ferrous-systems.com>2022-10-25 10:41:55 +0200
commit954649069ffe4a9d42bc0a83e07e6af4732300ea (patch)
tree5dd19bf32f4ab54f5d0ec93ff1870ca105c27814 /src/test
parent6457df3d4b945f2b56ada653e30116bb2267c004 (diff)
downloadrust-954649069ffe4a9d42bc0a83e07e6af4732300ea.tar.gz
rust-954649069ffe4a9d42bc0a83e07e6af4732300ea.zip
add a test to verify that compile-flags are provided last
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/compiletest-compile-flags-last.rs6
-rw-r--r--src/test/ui/compiletest-compile-flags-last.stderr2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/test/ui/compiletest-compile-flags-last.rs b/src/test/ui/compiletest-compile-flags-last.rs
new file mode 100644
index 00000000000..9c78e4c5e9d
--- /dev/null
+++ b/src/test/ui/compiletest-compile-flags-last.rs
@@ -0,0 +1,6 @@
+// Check that the arguments provided through `// compile-flags` are added last to the command line
+// in UI tests. To ensure that we invoke rustc with a flag that expects an argument withut actually
+// providing it. If the compile-flags are not last, the test will fail as rustc will interpret the
+// next flag as the argument of this flag.
+//
+// compile-flags: --cap-lints
diff --git a/src/test/ui/compiletest-compile-flags-last.stderr b/src/test/ui/compiletest-compile-flags-last.stderr
new file mode 100644
index 00000000000..d8d40a7d9f1
--- /dev/null
+++ b/src/test/ui/compiletest-compile-flags-last.stderr
@@ -0,0 +1,2 @@
+error: Argument to option 'cap-lints' missing
+