about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2018-09-18 10:21:37 +0200
committerGitHub <noreply@github.com>2018-09-18 10:21:37 +0200
commitcdd90343b383eaa00d05c7d332ed8a92bda30892 (patch)
tree2b1f01fdb8fe409bb640b51c5f52106d95c5616c
parent108be3cd6b0072b97767438081490a7e4de9bcf3 (diff)
parentfc6e1ed1e1cce232a654f7c585aec09e143cb46e (diff)
downloadrust-cdd90343b383eaa00d05c7d332ed8a92bda30892.tar.gz
rust-cdd90343b383eaa00d05c7d332ed8a92bda30892.zip
Rollup merge of #54225 - pnkfelix:issue-53675-add-test-called-panic, r=petrochenkov
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)".)

Fix #53675
-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");
+    }
+}