2020-02-01 23:09:22 -05:00
|
|
|
#![cfg(test)]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
mod macros;
|
|
|
|
|
|
|
|
test!(
|
|
|
|
removes_double_quotes,
|
|
|
|
"a {\n color: #{\"red\"};\n}\n",
|
|
|
|
"a {\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
removes_single_quotes,
|
|
|
|
"a {\n color: #{'red'};\n}\n",
|
|
|
|
"a {\n color: red;\n}\n"
|
|
|
|
);
|
2020-02-08 17:33:52 -05:00
|
|
|
test!(
|
|
|
|
number_after_interpolation,
|
|
|
|
"a {\n color: a#{foo}1;\n}\n",
|
|
|
|
"a {\n color: afoo1;\n}\n"
|
|
|
|
);
|
2020-02-14 13:27:08 -05:00
|
|
|
test!(
|
|
|
|
double_hyphen_before_interpolation,
|
|
|
|
"a {\n --#{foo}: red;\n}\n",
|
|
|
|
"a {\n --foo: red;\n}\n"
|
|
|
|
);
|
2020-02-24 16:58:48 -05:00
|
|
|
test!(
|
|
|
|
preserves_inner_single_quotes,
|
2020-03-01 12:03:14 -05:00
|
|
|
"a {\n color: #{\"''\"};\n}\n",
|
2020-02-24 16:58:48 -05:00
|
|
|
"a {\n color: '';\n}\n"
|
|
|
|
);
|
2020-02-24 18:58:09 -05:00
|
|
|
test!(
|
|
|
|
single_quotes_converted_to_double_when_interpolated,
|
2020-03-01 12:03:14 -05:00
|
|
|
"a {\n color: '#{foo}';\n}\n",
|
2020-02-24 18:58:09 -05:00
|
|
|
"a {\n color: \"foo\";\n}\n"
|
|
|
|
);
|
2020-04-19 22:41:37 -04:00
|
|
|
test!(
|
|
|
|
double_quotes_inside_double_quoted_string,
|
|
|
|
"a {\n color: #{\"#{'\"'}\"};\n}\n",
|
|
|
|
"a {\n color: \";\n}\n"
|
|
|
|
);
|
2020-04-19 22:54:56 -04:00
|
|
|
test!(
|
|
|
|
unquotes_space_separated_list,
|
|
|
|
"a {\n color: #{\"a\" 'b'};\n}\n",
|
|
|
|
"a {\n color: a b;\n}\n"
|
|
|
|
);
|
2020-04-20 11:34:49 -04:00
|
|
|
test!(
|
2020-04-20 11:48:17 -04:00
|
|
|
interpolated_newline,
|
2020-04-20 11:34:49 -04:00
|
|
|
"a {\n color: \"#{\"\\a\"}\";\n}\n",
|
|
|
|
"a {\n color: \"\\a\";\n}\n"
|
|
|
|
);
|
2020-04-20 11:48:17 -04:00
|
|
|
test!(
|
|
|
|
double_interpolated_newline,
|
|
|
|
"a {\n color: \"#{#{\"\\a\"}}\";\n}\n",
|
|
|
|
"a {\n color: \"\\a\";\n}\n"
|
|
|
|
);
|
2020-04-20 12:12:39 -04:00
|
|
|
test!(
|
|
|
|
interpolated_quoted_newline,
|
|
|
|
"a {\n color: #{\"\\a\"};\n}\n",
|
|
|
|
"a {\n color: ;\n}\n"
|
|
|
|
);
|
2020-04-22 10:57:57 -04:00
|
|
|
test!(
|
|
|
|
interpolate_escaped_quotes,
|
|
|
|
"a {\n color: #{\\\"\\'};\n}\n",
|
|
|
|
"a {\n color: \\\"\\';\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
interpolate_escaped_quotes_in_quotes,
|
|
|
|
"a {\n color: \"#{\\\"\\'}\";\n}\n",
|
|
|
|
"a {\n color: \"\\\\\\\"\\\\'\";\n}\n"
|
|
|
|
);
|
2020-05-14 00:10:19 -04:00
|
|
|
test!(
|
|
|
|
interpolated_plain_css_fn,
|
|
|
|
"$f: foo;\na {\n color: #{$f}(a, 1+2, c);\n}\n",
|
|
|
|
"a {\n color: foo(a, 3, c);\n}\n"
|
|
|
|
);
|