grass/tests/misc.rs
2020-03-17 10:28:04 -04:00

61 lines
1.4 KiB
Rust

#![cfg(test)]
#[macro_use]
mod macros;
test!(
ident_starts_with_hyphen,
"a {\n foo: -webkit-bar-baz;\n}\n"
);
test!(
ident_starts_with_double_hyphen,
"a {\n foo: --webkit-bar-baz;\n}\n"
);
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!(
emits_double_newline_between_unrelated_styles,
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n"
);
test!(
variable_interchangable_hypen_dash,
"$a-b: red; $a_b: green; a {\n color: $a-b;\n}\n",
"a {\n color: green;\n}\n"
);
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"
);
// these two precisiont tests only act like this in dart sass
// these values are `1` for libsass
test!(
precision_does_not_round_up,
"a {\n color: 0.99999999991;\n}\n",
"a {\n color: 0.9999999999;\n}\n"
);
test!(
precision_does_round_up,
"a {\n color: 1.00000000009;\n}\n",
"a {\n color: 1.0000000001;\n}\n"
);