Allow attributes in test macros

This commit is contained in:
ConnorSkees 2020-03-22 18:13:19 -04:00
parent 585786318f
commit 92809b1d03
3 changed files with 9 additions and 3 deletions

View File

@ -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"

View File

@ -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() {

View File

@ -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"