about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2018-09-14 14:06:05 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2018-09-15 06:34:09 +0200
commitfc6e1ed1e1cce232a654f7c585aec09e143cb46e (patch)
treeeab0655676c20bbb31a49cff30a3287cbbc28c79
parentf789b6bd6dc01a4412819c0733a6c99e092446fe (diff)
downloadrust-fc6e1ed1e1cce232a654f7c585aec09e143cb46e.tar.gz
rust-fc6e1ed1e1cce232a654f7c585aec09e143cb46e.zip
Regression test for rust-lang/rust#53675.
(Includes a couple variations on the theme. I confirmed that the ones
in `in_expression_position` and `what_if_we_use_panic_directly_in_expr`
both failed back on "rustc 1.30.0-nightly (0f063aef6 2018-09-03)".)
-rw-r--r--src/test/ui/issues/issue-53675-a-test-called-panic.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-53675-a-test-called-panic.rs b/src/test/ui/issues/issue-53675-a-test-called-panic.rs
new file mode 100644
index 00000000000..8a35b36d46d
--- /dev/null
+++ b/src/test/ui/issues/issue-53675-a-test-called-panic.rs
@@ -0,0 +1,36 @@
+// rust-lang/rust#53675: At one point the compiler errored when a test
+// named `panic` used the `assert!` macro in expression position.
+
+// compile-pass
+// compile-flags: --test
+
+mod in_expression_position {
+    #[test]
+    fn panic() {
+        assert!(true)
+    }
+}
+
+mod in_statement_position {
+    #[test]
+    fn panic() {
+        assert!(true);
+    }
+}
+
+mod what_if_we_use_panic_directly_in_expr {
+    #[test]
+    #[should_panic]
+    fn panic() {
+        panic!("in expr")
+    }
+}
+
+
+mod what_if_we_use_panic_directly_in_stmt {
+    #[test]
+    #[should_panic]
+    fn panic() {
+        panic!("in stmt");
+    }
+}