grass/tests/comments.rs

56 lines
1.2 KiB
Rust
Raw Normal View History

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!(
converts_cr_in_comment,
"a {\n color: 1 + // flang }\n blang }",
"a {\n color: 1blang;\n}\n"
2020-02-01 23:09:22 -05:00
);