grass/tests/misc.rs

105 lines
2.4 KiB
Rust
Raw Normal View History

2020-02-01 23:09:22 -05:00
#![cfg(test)]
#[macro_use]
mod macros;
test!(
ident_starts_with_hyphen,
"a {\n foo: -webkit-bar-baz;\n}\n"
);
2020-02-24 09:38:05 -05:00
test!(
ident_starts_with_double_hyphen,
"a {\n foo: --webkit-bar-baz;\n}\n"
);
2020-02-01 23:09:22 -05:00
test!(ident_with_num, "el1 {\n a: b;\n}\n");
test!(keyword_important, "a {\n height: 1 !important;\n}\n");
test!(
keyword_important_uppercase,
"a {\n height: 1 !IMPORTANT;\n}\n",
"a {\n height: 1 !important;\n}\n"
);
test!(
keyword_important_not_at_end,
"a {\n height: !important 1;\n}\n"
);
test!(
2020-02-02 17:44:39 -05:00
emits_double_newline_between_unrelated_styles,
2020-02-01 23:09:22 -05:00
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n"
);
test!(
variable_interchangable_hypen_dash,
"$a-b: red; $a_b: green; a {\n color: $a-b;\n}\n",
"a {\n color: green;\n}\n"
);
2020-02-29 15:54:13 -05:00
test!(
two_semicolons,
"a {\n color: red;;\n}\n",
"a {\n color: red;\n}\n"
);
test!(
five_semicolons,
"a {\n color: red;;;;;\n}\n",
"a {\n color: red;\n}\n"
);
test!(
two_semicolons_whitespace,
"a {\n color: red; ;\n}\n",
"a {\n color: red;\n}\n"
);
2020-03-20 23:53:26 -04:00
test!(
#[ignore]
utf8_ident_before_len,
2020-03-20 23:53:26 -04:00
"a {\n color: length(😀red);\n}\n",
"@charset \"UTF-8\";\na {\n color: 1;\n}\n"
);
test!(
#[ignore]
utf8_ident_before,
"a {\n color: 😀red;\n}\n",
"@charset \"UTF-8\";\na {\n color: 😀red;\n}\n"
);
test!(
#[ignore]
utf8_ident_after_len,
2020-03-20 23:53:26 -04:00
"a {\n color: length(red😁)\n}\n",
"@charset \"UTF-8\";\na {\n color: 1;\n}\n"
);
test!(
#[ignore]
utf8_ident_after,
"a {\n color: red😁\n}\n",
"@charset \"UTF-8\";\na {\n color: red😁;\n}\n"
);
2020-03-22 13:45:41 -04:00
test!(
escape_recognized_as_at_rule,
"@\\69 f true {\n a {\n b: c;\n }\n}\n",
"a {\n b: c;\n}\n"
);
test!(
escape_in_middle,
"a {\n color: b\\6cue;\n}\n",
"a {\n color: blue;\n}\n"
);
test!(
escape_at_end,
"a {\n color: blu\\65;\n}\n",
"a {\n color: blue;\n}\n"
);
test!(double_escape_is_preserved, "a {\n color: r\\\\65;\n}\n");
2020-03-23 16:29:55 -04:00
test!(semicolon_in_string, "a {\n color: \";\";\n}\n");
test!(
single_character_escape_sequence_has_space,
"a {\n color: \\fg1;\n}\n",
"a {\n color: \\f g1;\n}\n"
);
test!(
single_character_escape_sequence_removes_slash_when_not_hex_digit,
"a {\n color: \\g1;\n}\n",
"a {\n color: g1;\n}\n"
);
test!(
single_character_escape_sequence_has_space_after,
"a {\n color: \\0;\n}\n",
"a {\n color: \\0 ;\n}\n"
);