grass/tests/units.rs

47 lines
1.1 KiB
Rust
Raw Normal View History

2020-02-01 23:09:22 -05:00
#![cfg(test)]
#[macro_use]
mod macros;
test!(unit_none, "a {\n height: 1;\n}\n");
test!(unit_not_attached, "a {\n height: 1 px;\n}\n");
test!(unit_px, "a {\n height: 1px;\n}\n");
test!(unit_em, "a {\n height: 1em;\n}\n");
test!(unit_rem, "a {\n height: 1rem;\n}\n");
test!(unit_percent, "a {\n height: 1%;\n}\n");
2020-03-16 21:29:00 -04:00
test!(
unit_times_none,
"a {\n color: 3px * 2;\n}\n",
"a {\n color: 6px;\n}\n"
);
test!(
none_times_unit,
"a {\n color: 2 * 3px;\n}\n",
"a {\n color: 6px;\n}\n"
);
test!(
unit_fn_unit_times_none,
"a {\n color: unit(1px * 1);\n}\n",
"a {\n color: \"px\";\n}\n"
);
test!(
unit_fn_none_times_unit,
"a {\n color: unit(1 * 1px);\n}\n",
"a {\n color: \"px\";\n}\n"
);
test!(
unit_fn_unit_times_unit,
"a {\n color: unit(1px*1px);\n}\n",
"a {\n color: \"px*px\";\n}\n"
);
test!(
unit_fn_unit_times_unit_times_unit,
"a {\n color: unit(1px * 1rad * 1em);\n}\n",
"a {\n color: \"px*rad*em\";\n}\n"
);
test!(
unit_none_times_none_times_none,
"a {\n color: 1 * 1 * 1;\n}\n",
"a {\n color: 1;\n}\n"
);