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"
|
|
|
|
);
|
2020-02-08 17:33:52 -05:00
|
|
|
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!(
|
2020-03-21 17:29:12 -04:00
|
|
|
utf8_ident_before_len,
|
2020-03-20 23:53:26 -04:00
|
|
|
"a {\n color: length(😀red);\n}\n",
|
2020-04-05 23:20:47 -04:00
|
|
|
"a {\n color: 1;\n}\n"
|
2020-03-20 23:53:26 -04:00
|
|
|
);
|
|
|
|
test!(
|
2020-03-21 17:29:12 -04:00
|
|
|
utf8_ident_before,
|
|
|
|
"a {\n color: 😀red;\n}\n",
|
|
|
|
"@charset \"UTF-8\";\na {\n color: 😀red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
utf8_ident_after_len,
|
2020-03-20 23:53:26 -04:00
|
|
|
"a {\n color: length(red😁)\n}\n",
|
2020-04-05 23:20:47 -04:00
|
|
|
"a {\n color: 1;\n}\n"
|
2020-03-20 23:53:26 -04:00
|
|
|
);
|
2020-03-21 17:29:12 -04:00
|
|
|
test!(
|
|
|
|
utf8_ident_after,
|
|
|
|
"a {\n color: red😁\n}\n",
|
|
|
|
"@charset \"UTF-8\";\na {\n color: red😁;\n}\n"
|
|
|
|
);
|
2020-03-29 13:28:17 -04:00
|
|
|
test!(
|
|
|
|
no_space_before_style,
|
|
|
|
"a {\n color:red\n}\n",
|
|
|
|
"a {\n color: red;\n}\n"
|
|
|
|
);
|
2020-03-29 22:17:56 -04:00
|
|
|
test!(
|
|
|
|
does_not_combine_idents_with_leading_hyphen,
|
|
|
|
"a {\n color: a -b;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
does_not_combine_idents_with_leading_hyphen_list,
|
|
|
|
"a {\n color: a -b c;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
does_not_combine_idents_with_leading_hyphen_all,
|
|
|
|
"a {\n color: -a -b -c;\n}\n"
|
|
|
|
);
|
2020-03-29 23:00:39 -04:00
|
|
|
test!(
|
2020-03-30 15:07:06 -04:00
|
|
|
allows_escaped_quote_at_start_of_ident,
|
2020-03-29 23:00:39 -04:00
|
|
|
"a {\n color: \\\"c\\\";\n}\n"
|
|
|
|
);
|
2020-03-30 15:07:06 -04:00
|
|
|
test!(
|
|
|
|
args_handles_arbitrary_number_of_parens,
|
|
|
|
"a {\n color: inspect((((((a))))));\n}\n",
|
|
|
|
"a {\n color: a;\n}\n"
|
|
|
|
);
|
2020-03-31 22:00:38 -04:00
|
|
|
test!(
|
|
|
|
allow_spaces_after_exclamation_point,
|
|
|
|
"a {\n color: foo ! important;\n}\n",
|
|
|
|
"a {\n color: foo !important;\n}\n"
|
|
|
|
);
|
2020-03-31 23:39:32 -04:00
|
|
|
test!(
|
|
|
|
values_after_important,
|
|
|
|
"a {\n color: foo bar !important hux baz;\n}\n"
|
|
|
|
);
|
2020-04-01 19:35:04 -04:00
|
|
|
test!(
|
|
|
|
no_space_between_colon_and_style_variable,
|
|
|
|
"$base-color: #036;\na {\n color:lighten($base-color, 5%);\n}",
|
|
|
|
"a {\n color: #004080;\n}\n"
|
|
|
|
);
|
2020-04-04 03:00:38 -04:00
|
|
|
test!(
|
|
|
|
semicolon_after_closing_brace,
|
|
|
|
"a {\n color: foo;\n};",
|
|
|
|
"a {\n color: foo;\n}\n"
|
|
|
|
);
|
2020-04-13 12:57:25 -04:00
|
|
|
test!(
|
|
|
|
builtin_functions_interchangeable_underscore_hyphen,
|
|
|
|
"a {\n color: ie_hex-str(rgba(0, 255, 0, 0.5));\n}\n",
|
|
|
|
"a {\n color: #8000FF00;\n}\n"
|
|
|
|
);
|