From 92809b1d032d72159be3390d7a1f53021cfa7328 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 22 Mar 2020 18:13:19 -0400 Subject: [PATCH] Allow attributes in test macros --- tests/charset.rs | 2 ++ tests/macros.rs | 9 ++++++--- tests/strings.rs | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/charset.rs b/tests/charset.rs index 90efc30..51c2f47 100644 --- a/tests/charset.rs +++ b/tests/charset.rs @@ -4,11 +4,13 @@ mod macros; test!( + #[ignore] utf8_input, "a {\n color: 🦆;\n}\n", "@charset \"UTF-8\";\na {\n color: 🦆;\n}\n" ); test!( + #[ignore] ascii_charset_utf8, "@charset \"UTF-8\";\na {\n color: red;\n}\n", "a {\n color: red;\n}\n" diff --git a/tests/macros.rs b/tests/macros.rs index 8d7b0bc..55d424d 100644 --- a/tests/macros.rs +++ b/tests/macros.rs @@ -2,7 +2,8 @@ #[macro_export] macro_rules! test { - ($func:ident, $input:expr) => { + ($( #[$attr:meta] ),*$func:ident, $input:expr) => { + $(#[$attr])* #[test] #[allow(non_snake_case)] fn $func() { @@ -17,7 +18,8 @@ macro_rules! test { ); } }; - ($func:ident, $input:expr, $output:expr) => { + ($( #[$attr:meta] ),*$func:ident, $input:expr, $output:expr) => { + $(#[$attr])* #[test] #[allow(non_snake_case)] fn $func() { @@ -36,7 +38,8 @@ macro_rules! test { #[macro_export] macro_rules! error { - ($func:ident, $input:expr, $err:expr) => { + ($( #[$attr:meta] ),*$func:ident, $input:expr, $err:expr) => { + $(#[$attr])* #[test] #[allow(non_snake_case)] fn $func() { diff --git a/tests/strings.rs b/tests/strings.rs index 17e9bbd..e8ccc58 100644 --- a/tests/strings.rs +++ b/tests/strings.rs @@ -184,6 +184,7 @@ test!( "a {\n color: Xabcd;\n}\n" ); test!( + #[ignore] str_insert_double_width_char, "a {\n color: str-insert(\"👭\", \"c\", 2);\n}\n", "@charset \"UTF-8\";\na {\n color: \"👭c\";\n}\n"