2020-03-30 10:10:51 -04:00
|
|
|
#![cfg(test)]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
mod macros;
|
|
|
|
|
|
|
|
test!(
|
|
|
|
subs_idents,
|
|
|
|
"a {\n color: foo - bar;\n}\n",
|
|
|
|
"a {\n color: foo-bar;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_quoted_idents,
|
|
|
|
"a {\n color: \"foo\" - \"bar\";\n}\n",
|
|
|
|
"a {\n color: \"foo\"-\"bar\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_sgl_quoted_idents,
|
|
|
|
"a {\n color: 'foo' - 'bar';\n}\n",
|
|
|
|
"a {\n color: \"foo\"-\"bar\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_and_un_quoted_idents,
|
|
|
|
"a {\n color: \"foo\" - bar;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-bar;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_sgl_and_un_quoted_idents,
|
|
|
|
"a {\n color: 'foo' - bar;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-bar;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_un_and_dbl_quoted_idents,
|
|
|
|
"a {\n color: foo - \"bar\";\n}\n",
|
|
|
|
"a {\n color: foo-\"bar\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_un_and_sgl_quoted_idents,
|
|
|
|
"a {\n color: foo - 'bar';\n}\n",
|
|
|
|
"a {\n color: foo-\"bar\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_sgl_and_dbl_quoted_idents,
|
|
|
|
"a {\n color: 'foo' - \"bar\";\n}\n",
|
|
|
|
"a {\n color: \"foo\"-\"bar\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_and_sgl_quoted_idents,
|
|
|
|
"a {\n color: \"foo\" - 'bar';\n}\n",
|
|
|
|
"a {\n color: \"foo\"-\"bar\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_ident_true,
|
|
|
|
"a {\n color: foo - true;\n}\n",
|
|
|
|
"a {\n color: foo-true;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_quoted_ident_true,
|
|
|
|
"a {\n color: \"foo\" - true;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-true;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_ident_false,
|
|
|
|
"a {\n color: foo - false;\n}\n",
|
|
|
|
"a {\n color: foo-false;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_quoted_ident_false,
|
|
|
|
"a {\n color: \"foo\" - false;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-false;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_ident_important,
|
|
|
|
"a {\n color: foo - !important;\n}\n",
|
|
|
|
"a {\n color: foo-!important;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_ident_null,
|
|
|
|
"a {\n color: foo - null;\n}\n",
|
|
|
|
"a {\n color: foo-;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_quoted_ident_null,
|
|
|
|
"a {\n color: \"foo\" - null;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_sgl_quoted_ident_null,
|
|
|
|
"a {\n color: 'foo' - null;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_ident_number,
|
|
|
|
"a {\n color: foo - 1;\n}\n",
|
|
|
|
"a {\n color: foo-1;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_quoted_ident_number,
|
|
|
|
"a {\n color: \"foo\" - 1;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-1;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_sgl_quoted_ident_number,
|
|
|
|
"a {\n color: 'foo' - 1;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-1;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_ident_dimension,
|
|
|
|
"a {\n color: foo - 1px;\n}\n",
|
|
|
|
"a {\n color: foo-1px;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
num_minus_list,
|
|
|
|
"a {\n color: 1 - (2 3);\n}\n",
|
|
|
|
"a {\n color: 1-2 3;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
list_minus_num,
|
|
|
|
"a {\n color: (1 2) - 3;\n}\n",
|
|
|
|
"a {\n color: 1 2-3;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
dblquoted_minus_list,
|
|
|
|
"a {\n color: \"1\" - (2 3);\n}\n",
|
|
|
|
"a {\n color: \"1\"-2 3;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
list_minus_dblquoted,
|
|
|
|
"a {\n color: (1 2) - \"3\";\n}\n",
|
|
|
|
"a {\n color: 1 2-\"3\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
sglquoted_minus_list,
|
|
|
|
"a {\n color: 'a' - (b c);\n}\n",
|
|
|
|
"a {\n color: \"a\"-b c;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
list_minus_sglquoted,
|
|
|
|
"a {\n color: (b c) - 'a';\n}\n",
|
|
|
|
"a {\n color: b c-\"a\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
list_minus_list,
|
|
|
|
"a {\n color: (a b) - (1 2);\n}\n",
|
|
|
|
"a {\n color: a b-1 2;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_dbl_quoted_ident_dimension,
|
|
|
|
"a {\n color: \"foo\" - 1px;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-1px;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
subs_sgl_quoted_ident_dimension,
|
|
|
|
"a {\n color: 'foo' - 1px;\n}\n",
|
|
|
|
"a {\n color: \"foo\"-1px;\n}\n"
|
|
|
|
);
|
2020-03-31 01:52:52 -04:00
|
|
|
test!(
|
|
|
|
number_minus_unquoted_ident,
|
|
|
|
"a {\n color: 1 - foo;\n}\n",
|
|
|
|
"a {\n color: 1-foo;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
number_minus_sglquoted_ident,
|
|
|
|
"a {\n color: 1 - 'foo';\n}\n",
|
|
|
|
"a {\n color: 1-\"foo\";\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
number_minus_dblquoted_ident,
|
|
|
|
"a {\n color: 1 - \"foo\";\n}\n",
|
|
|
|
"a {\n color: 1-\"foo\";\n}\n"
|
|
|
|
);
|
2020-04-01 15:32:52 -04:00
|
|
|
test!(
|
|
|
|
number_minus_minus_number,
|
2020-04-20 01:56:53 -04:00
|
|
|
"a {\n color: 1 - - 2;\n}\n",
|
2020-04-01 15:32:52 -04:00
|
|
|
"a {\n color: 3;\n}\n"
|
|
|
|
);
|
2020-04-20 01:56:53 -04:00
|
|
|
test!(
|
|
|
|
sub_no_space,
|
|
|
|
"a {\n color: 10-10;\n}\n",
|
|
|
|
"a {\n color: 0;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
sub_space_on_left,
|
|
|
|
"a {\n color: 10 -10;\n}\n",
|
|
|
|
"a {\n color: 10 -10;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
sub_space_on_right,
|
|
|
|
"a {\n color: 10- 10;\n}\n",
|
|
|
|
"a {\n color: 0;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
sub_space_on_both,
|
|
|
|
"a {\n color: 10 - 10;\n}\n",
|
|
|
|
"a {\n color: 0;\n}\n"
|
|
|
|
);
|
2020-04-20 02:06:45 -04:00
|
|
|
test!(
|
|
|
|
#[ignore]
|
|
|
|
sub_no_space_interpolation,
|
|
|
|
"a {\n color: 10-#{10};\n}\n",
|
|
|
|
"a {\n color: 10 -10;\n}\n"
|
|
|
|
);
|
2020-04-20 02:19:54 -04:00
|
|
|
test!(
|
|
|
|
plus_after_minus,
|
|
|
|
"a {\n plus-after-minus: 1 - + 2;\n}\n",
|
|
|
|
"a {\n plus-after-minus: -1;\n}\n"
|
|
|
|
);
|
2020-04-23 19:44:20 -04:00
|
|
|
test!(
|
|
|
|
multiline_comments_between_operands,
|
|
|
|
"a {\n color: 1/**/-/**/1;\n}\n",
|
|
|
|
"a {\n color: 0;\n}\n"
|
|
|
|
);
|
2020-04-25 20:19:50 -04:00
|
|
|
test!(
|
|
|
|
no_space_after_first_unit_and_second_float,
|
|
|
|
"a {\n color: 1em- 0.0em;\n}\n",
|
|
|
|
"a {\n color: 1em- 0em;\n}\n"
|
|
|
|
);
|