2020-02-01 23:09:22 -05:00
|
|
|
#![cfg(test)]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
mod macros;
|
|
|
|
|
|
|
|
test!(
|
|
|
|
removes_inner_comments,
|
|
|
|
"a {\n color: red/* hi */;\n}\n",
|
|
|
|
"a {\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
removes_inner_comments_whitespace,
|
|
|
|
"a {\n color: red /* hi */;\n}\n",
|
|
|
|
"a {\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
preserves_outer_comments_before,
|
|
|
|
"a {\n /* hi */\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
preserves_outer_comments_after,
|
|
|
|
"a {\n color: red;\n /* hi */\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
preserves_outer_comments_two,
|
|
|
|
"a {\n /* foo */\n /* bar */\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
preserves_toplevel_comment_before,
|
|
|
|
"/* foo */\na {\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
preserves_toplevel_comment_after,
|
|
|
|
"a {\n color: red;\n}\n/* foo */\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
removes_single_line_comment,
|
|
|
|
"// a { color: red }\na {\n height: 1 1px;\n}\n",
|
|
|
|
"a {\n height: 1 1px;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
converts_form_feed_in_comment,
|
|
|
|
"a {\n /* \x0C*/ color: red;\n}\n",
|
|
|
|
"a {\n /* \n*/\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
converts_crlf_in_comment,
|
|
|
|
"a {\n /* \r\n*/ color: red;\n}\n",
|
|
|
|
"a {\n /* \n*/\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
2020-04-18 21:01:12 -04:00
|
|
|
closing_curly_brace_in_comment,
|
2020-03-30 02:21:41 -04:00
|
|
|
"a {\n color: 1 + // flang }\n blang }",
|
|
|
|
"a {\n color: 1blang;\n}\n"
|
2020-02-01 23:09:22 -05:00
|
|
|
);
|
2020-04-18 21:01:12 -04:00
|
|
|
test!(
|
|
|
|
converts_cr_in_comment,
|
|
|
|
"a {\n /* \r*/ color: red;\n}\n",
|
|
|
|
"a {\n /* \n*/\n color: red;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
interpolation_in_multiline_comment,
|
|
|
|
"$a: foo;/* interpolation #{1 + 1} in #{$a} comments */",
|
|
|
|
"/* interpolation 2 in foo comments */\n"
|
|
|
|
);
|