From 9f614cb1a08611df0a6c8d3b47de632904d7626e Mon Sep 17 00:00:00 2001 From: Tshepang Mbambo Date: Sun, 18 Feb 2024 22:51:19 +0200 Subject: [PATCH] add test for panicking attribute macros --- tests/ui/proc-macro/custom-attr-panic.rs | 8 ++++++++ tests/ui/proc-macro/custom-attr-panic.stderr | 10 ++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/ui/proc-macro/custom-attr-panic.rs create mode 100644 tests/ui/proc-macro/custom-attr-panic.stderr diff --git a/tests/ui/proc-macro/custom-attr-panic.rs b/tests/ui/proc-macro/custom-attr-panic.rs new file mode 100644 index 00000000000..23bcb66319d --- /dev/null +++ b/tests/ui/proc-macro/custom-attr-panic.rs @@ -0,0 +1,8 @@ +//@ aux-build: test-macros.rs + +extern crate test_macros; + +#[test_macros::panic_attr] //~ ERROR custom attribute panicked +fn foo() {} + +fn main() {} diff --git a/tests/ui/proc-macro/custom-attr-panic.stderr b/tests/ui/proc-macro/custom-attr-panic.stderr new file mode 100644 index 00000000000..e436162bcc1 --- /dev/null +++ b/tests/ui/proc-macro/custom-attr-panic.stderr @@ -0,0 +1,10 @@ +error: custom attribute panicked + --> $DIR/custom-attr-panic.rs:5:1 + | +LL | #[test_macros::panic_attr] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: message: panic-attr + +error: aborting due to 1 previous error +