remove test macro shorthand for unchanged output
This commit is contained in:
parent
d7e7053d03
commit
884b92f476
@ -1,34 +1,81 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
test!(preserves_named_color_case, "a {\n color: OrAnGe;\n}\n");
|
test!(
|
||||||
|
preserves_named_color_case,
|
||||||
|
"a {\n color: OrAnGe;\n}\n",
|
||||||
|
"a {\n color: OrAnGe;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
named_color_casing_is_color,
|
named_color_casing_is_color,
|
||||||
"a {\n color: hue(RED);\n}\n",
|
"a {\n color: hue(RED);\n}\n",
|
||||||
"a {\n color: 0deg;\n}\n"
|
"a {\n color: 0deg;\n}\n"
|
||||||
);
|
);
|
||||||
test!(preserves_hex_color_case, "a {\n color: #FfFfFf;\n}\n");
|
test!(
|
||||||
|
preserves_hex_color_case,
|
||||||
|
"a {\n color: #FfFfFf;\n}\n",
|
||||||
|
"a {\n color: #FfFfFf;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_hex_8_val_10000000,
|
preserves_hex_8_val_10000000,
|
||||||
|
"a {\n color: #10000000;\n}\n",
|
||||||
"a {\n color: #10000000;\n}\n"
|
"a {\n color: #10000000;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_hex_8_val_12312312,
|
preserves_hex_8_val_12312312,
|
||||||
|
"a {\n color: #12312312;\n}\n",
|
||||||
"a {\n color: #12312312;\n}\n"
|
"a {\n color: #12312312;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_hex_8_val_ab234cff,
|
preserves_hex_8_val_ab234cff,
|
||||||
|
"a {\n color: #ab234cff;\n}\n",
|
||||||
"a {\n color: #ab234cff;\n}\n"
|
"a {\n color: #ab234cff;\n}\n"
|
||||||
);
|
);
|
||||||
test!(preserves_hex_6_val_000000, "a {\n color: #000000;\n}\n");
|
test!(
|
||||||
test!(preserves_hex_6_val_123123, "a {\n color: #123123;\n}\n");
|
preserves_hex_6_val_000000,
|
||||||
test!(preserves_hex_6_val_ab234c, "a {\n color: #ab234c;\n}\n");
|
"a {\n color: #000000;\n}\n",
|
||||||
test!(preserves_hex_4_val_0000, "a {\n color: #0000;\n}\n");
|
"a {\n color: #000000;\n}\n"
|
||||||
test!(preserves_hex_4_val_123a, "a {\n color: #123a;\n}\n");
|
);
|
||||||
test!(preserves_hex_4_val_ab2f, "a {\n color: #ab2f;\n}\n");
|
test!(
|
||||||
test!(preserves_hex_3_val_000, "a {\n color: #000;\n}\n");
|
preserves_hex_6_val_123123,
|
||||||
test!(preserves_hex_3_val_123, "a {\n color: #123;\n}\n");
|
"a {\n color: #123123;\n}\n",
|
||||||
test!(preserves_hex_3_val_ab2, "a {\n color: #ab2;\n}\n");
|
"a {\n color: #123123;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_6_val_ab234c,
|
||||||
|
"a {\n color: #ab234c;\n}\n",
|
||||||
|
"a {\n color: #ab234c;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_4_val_0000,
|
||||||
|
"a {\n color: #0000;\n}\n",
|
||||||
|
"a {\n color: #0000;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_4_val_123a,
|
||||||
|
"a {\n color: #123a;\n}\n",
|
||||||
|
"a {\n color: #123a;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_4_val_ab2f,
|
||||||
|
"a {\n color: #ab2f;\n}\n",
|
||||||
|
"a {\n color: #ab2f;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_3_val_000,
|
||||||
|
"a {\n color: #000;\n}\n",
|
||||||
|
"a {\n color: #000;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_3_val_123,
|
||||||
|
"a {\n color: #123;\n}\n",
|
||||||
|
"a {\n color: #123;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_hex_3_val_ab2,
|
||||||
|
"a {\n color: #ab2;\n}\n",
|
||||||
|
"a {\n color: #ab2;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
converts_rgb_to_named_color,
|
converts_rgb_to_named_color,
|
||||||
"a {\n color: rgb(0, 0, 0);\n}\n",
|
"a {\n color: rgb(0, 0, 0);\n}\n",
|
||||||
@ -84,9 +131,14 @@ test!(
|
|||||||
"a {\n color: alpha(red);\n}\n",
|
"a {\n color: alpha(red);\n}\n",
|
||||||
"a {\n color: 1;\n}\n"
|
"a {\n color: 1;\n}\n"
|
||||||
);
|
);
|
||||||
test!(opacity_function_number, "a {\n color: opacity(1);\n}\n");
|
test!(
|
||||||
|
opacity_function_number,
|
||||||
|
"a {\n color: opacity(1);\n}\n",
|
||||||
|
"a {\n color: opacity(1);\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
opacity_function_number_unit,
|
opacity_function_number_unit,
|
||||||
|
"a {\n color: opacity(1px);\n}\n",
|
||||||
"a {\n color: opacity(1px);\n}\n"
|
"a {\n color: opacity(1px);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
|
@ -13,22 +13,27 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_outer_comments_before,
|
preserves_outer_comments_before,
|
||||||
|
"a {\n /* hi */\n color: red;\n}\n",
|
||||||
"a {\n /* hi */\n color: red;\n}\n"
|
"a {\n /* hi */\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_outer_comments_after,
|
preserves_outer_comments_after,
|
||||||
|
"a {\n color: red;\n /* hi */\n}\n",
|
||||||
"a {\n color: red;\n /* hi */\n}\n"
|
"a {\n color: red;\n /* hi */\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_outer_comments_two,
|
preserves_outer_comments_two,
|
||||||
|
"a {\n /* foo */\n /* bar */\n color: red;\n}\n",
|
||||||
"a {\n /* foo */\n /* bar */\n color: red;\n}\n"
|
"a {\n /* foo */\n /* bar */\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_toplevel_comment_before,
|
preserves_toplevel_comment_before,
|
||||||
|
"/* foo */\na {\n color: red;\n}\n",
|
||||||
"/* foo */\na {\n color: red;\n}\n"
|
"/* foo */\na {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_toplevel_comment_after,
|
preserves_toplevel_comment_after,
|
||||||
|
"a {\n color: red;\n}\n/* foo */\n",
|
||||||
"a {\n color: red;\n}\n/* foo */\n"
|
"a {\n color: red;\n}\n/* foo */\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
|
@ -111,7 +111,11 @@ test!(
|
|||||||
"@if false {}\n\n@Else {\n a {\n color: red;\n }\n}\n",
|
"@if false {}\n\n@Else {\n a {\n color: red;\n }\n}\n",
|
||||||
"@Else {\n a {\n color: red;\n }\n}\n"
|
"@Else {\n a {\n color: red;\n }\n}\n"
|
||||||
);
|
);
|
||||||
test!(uppercase_if, "@If true {\n a {\n color: red;\n }\n}\n");
|
test!(
|
||||||
|
uppercase_if,
|
||||||
|
"@If true {\n a {\n color: red;\n }\n}\n",
|
||||||
|
"@If true {\n a {\n color: red;\n }\n}\n"
|
||||||
|
);
|
||||||
error!(nothing_after_if, "@if", "Error: Expected expression.");
|
error!(nothing_after_if, "@if", "Error: Expected expression.");
|
||||||
error!(
|
error!(
|
||||||
nothing_after_dollar,
|
nothing_after_dollar,
|
||||||
|
@ -257,10 +257,26 @@ test!(
|
|||||||
"a {\n color: join([a], (b, ));\n}\n",
|
"a {\n color: join([a], (b, ));\n}\n",
|
||||||
"a {\n color: [a, b];\n}\n"
|
"a {\n color: [a, b];\n}\n"
|
||||||
);
|
);
|
||||||
test!(bracketed_ident, "a {\n color: [a];\n}\n");
|
test!(
|
||||||
test!(bracketed_space_list, "a {\n color: [a b];\n}\n");
|
bracketed_ident,
|
||||||
test!(bracketed_comma_list, "a {\n color: [a, b];\n}\n");
|
"a {\n color: [a];\n}\n",
|
||||||
test!(bracketed_as_space_list, "a {\n color: [a b] c;\n}\n");
|
"a {\n color: [a];\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
bracketed_space_list,
|
||||||
|
"a {\n color: [a b];\n}\n",
|
||||||
|
"a {\n color: [a b];\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
bracketed_comma_list,
|
||||||
|
"a {\n color: [a, b];\n}\n",
|
||||||
|
"a {\n color: [a, b];\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
bracketed_as_space_list,
|
||||||
|
"a {\n color: [a b] c;\n}\n",
|
||||||
|
"a {\n color: [a b] c;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
trailing_comma_bare,
|
trailing_comma_bare,
|
||||||
"a {\n color: 1,;\n}\n",
|
"a {\n color: 1,;\n}\n",
|
||||||
@ -293,14 +309,17 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
long_space_separated_list,
|
long_space_separated_list,
|
||||||
|
"a {\n color: a b c d e f g h i j k l m n o p q r s t u v w x y z;\n}\n",
|
||||||
"a {\n color: a b c d e f g h i j k l m n o p q r s t u v w x y z;\n}\n"
|
"a {\n color: a b c d e f g h i j k l m n o p q r s t u v w x y z;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
long_comma_separated_list,
|
long_comma_separated_list,
|
||||||
|
"a {\n color: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;\n}\n",
|
||||||
"a {\n color: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;\n}\n"
|
"a {\n color: a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
deeply_nested_square_braces,
|
deeply_nested_square_braces,
|
||||||
|
"a {\n color: [[[[[[a]]]]]];\n}\n",
|
||||||
"a {\n color: [[[[[[a]]]]]];\n}\n"
|
"a {\n color: [[[[[[a]]]]]];\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -338,7 +357,11 @@ test!(
|
|||||||
"a {\n color: length(zip((a, b, c)));\n}\n",
|
"a {\n color: length(zip((a, b, c)));\n}\n",
|
||||||
"a {\n color: 3;\n}\n"
|
"a {\n color: 3;\n}\n"
|
||||||
);
|
);
|
||||||
test!(empty_bracketed_list, "a {\n empty: [];\n}\n");
|
test!(
|
||||||
|
empty_bracketed_list,
|
||||||
|
"a {\n empty: [];\n}\n",
|
||||||
|
"a {\n empty: [];\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
empty_bracketed_list_equality,
|
empty_bracketed_list_equality,
|
||||||
"a {\n color: []==[];\n}\n",
|
"a {\n color: []==[];\n}\n",
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! test {
|
macro_rules! test {
|
||||||
($( #[$attr:meta] ),*$func:ident, $input:expr) => {
|
|
||||||
$(#[$attr])*
|
|
||||||
#[test]
|
|
||||||
#[allow(non_snake_case)]
|
|
||||||
fn $func() {
|
|
||||||
let sass = grass::from_string($input.to_string(), &grass::Options::default())
|
|
||||||
.expect(concat!("failed to parse on ", $input));
|
|
||||||
assert_eq!(
|
|
||||||
String::from($input),
|
|
||||||
sass
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
($( #[$attr:meta] ),*$func:ident, $input:expr, $output:expr) => {
|
($( #[$attr:meta] ),*$func:ident, $input:expr, $output:expr) => {
|
||||||
$(#[$attr])*
|
$(#[$attr])*
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -3,6 +3,7 @@ mod macros;
|
|||||||
|
|
||||||
test!(
|
test!(
|
||||||
basic_toplevel,
|
basic_toplevel,
|
||||||
|
"@media foo {\n a {\n color: red;\n }\n}\n",
|
||||||
"@media foo {\n a {\n color: red;\n }\n}\n"
|
"@media foo {\n a {\n color: red;\n }\n}\n"
|
||||||
);
|
);
|
||||||
error!(
|
error!(
|
||||||
|
@ -3,15 +3,18 @@ mod macros;
|
|||||||
|
|
||||||
test!(
|
test!(
|
||||||
ident_starts_with_hyphen,
|
ident_starts_with_hyphen,
|
||||||
|
"a {\n foo: -webkit-bar-baz;\n}\n",
|
||||||
"a {\n foo: -webkit-bar-baz;\n}\n"
|
"a {\n foo: -webkit-bar-baz;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
ident_starts_with_double_hyphen,
|
ident_starts_with_double_hyphen,
|
||||||
|
"a {\n foo: --webkit-bar-baz;\n}\n",
|
||||||
"a {\n foo: --webkit-bar-baz;\n}\n"
|
"a {\n foo: --webkit-bar-baz;\n}\n"
|
||||||
);
|
);
|
||||||
test!(ident_with_num, "el1 {\n a: b;\n}\n");
|
test!(ident_with_num, "el1 {\n a: b;\n}\n", "el1 {\n a: b;\n}\n");
|
||||||
test!(
|
test!(
|
||||||
emits_double_newline_between_unrelated_styles,
|
emits_double_newline_between_unrelated_styles,
|
||||||
|
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n",
|
||||||
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n"
|
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -61,14 +64,17 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
does_not_combine_idents_with_leading_hyphen,
|
does_not_combine_idents_with_leading_hyphen,
|
||||||
|
"a {\n color: a -b;\n}\n",
|
||||||
"a {\n color: a -b;\n}\n"
|
"a {\n color: a -b;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
does_not_combine_idents_with_leading_hyphen_list,
|
does_not_combine_idents_with_leading_hyphen_list,
|
||||||
|
"a {\n color: a -b c;\n}\n",
|
||||||
"a {\n color: a -b c;\n}\n"
|
"a {\n color: a -b c;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
does_not_combine_idents_with_leading_hyphen_all,
|
does_not_combine_idents_with_leading_hyphen_all,
|
||||||
|
"a {\n color: -a -b -c;\n}\n",
|
||||||
"a {\n color: -a -b -c;\n}\n"
|
"a {\n color: -a -b -c;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
|
@ -33,9 +33,21 @@ test!(
|
|||||||
"a {\n color: 1.0000;\n}\n",
|
"a {\n color: 1.0000;\n}\n",
|
||||||
"a {\n color: 1;\n}\n"
|
"a {\n color: 1;\n}\n"
|
||||||
);
|
);
|
||||||
test!(many_nines_not_rounded, "a {\n color: 0.999999;\n}\n");
|
test!(
|
||||||
test!(positive_integer, "a {\n color: 1;\n}\n");
|
many_nines_not_rounded,
|
||||||
test!(negative_integer, "a {\n color: -1;\n}\n");
|
"a {\n color: 0.999999;\n}\n",
|
||||||
|
"a {\n color: 0.999999;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
positive_integer,
|
||||||
|
"a {\n color: 1;\n}\n",
|
||||||
|
"a {\n color: 1;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
negative_integer,
|
||||||
|
"a {\n color: -1;\n}\n",
|
||||||
|
"a {\n color: -1;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
positive_float_no_leading_zero,
|
positive_float_no_leading_zero,
|
||||||
"a {\n color: .1;\n}\n",
|
"a {\n color: .1;\n}\n",
|
||||||
@ -46,8 +58,16 @@ test!(
|
|||||||
"a {\n color: -.1;\n}\n",
|
"a {\n color: -.1;\n}\n",
|
||||||
"a {\n color: -0.1;\n}\n"
|
"a {\n color: -0.1;\n}\n"
|
||||||
);
|
);
|
||||||
test!(positive_float_leading_zero, "a {\n color: 0.1;\n}\n");
|
test!(
|
||||||
test!(negative_float_leading_zero, "a {\n color: -0.1;\n}\n");
|
positive_float_leading_zero,
|
||||||
|
"a {\n color: 0.1;\n}\n",
|
||||||
|
"a {\n color: 0.1;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
negative_float_leading_zero,
|
||||||
|
"a {\n color: -0.1;\n}\n",
|
||||||
|
"a {\n color: -0.1;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
negative_near_zero_no_sign,
|
negative_near_zero_no_sign,
|
||||||
"a {\n color: -0.000000000001;\n}\n",
|
"a {\n color: -0.000000000001;\n}\n",
|
||||||
@ -98,7 +118,7 @@ test!(
|
|||||||
"a {\n color: 1.2e-5;\n}\n",
|
"a {\n color: 1.2e-5;\n}\n",
|
||||||
"a {\n color: 0.000012;\n}\n"
|
"a {\n color: 0.000012;\n}\n"
|
||||||
);
|
);
|
||||||
test!(unit_e, "a {\n color: 1e;\n}\n");
|
test!(unit_e, "a {\n color: 1e;\n}\n", "a {\n color: 1e;\n}\n");
|
||||||
test!(
|
test!(
|
||||||
positive_scientific_notation_zero,
|
positive_scientific_notation_zero,
|
||||||
"a {\n color: 1e0;\n}\n",
|
"a {\n color: 1e0;\n}\n",
|
||||||
|
@ -6,30 +6,70 @@ test!(
|
|||||||
"a, b {\n a, b {\n color: red\n}\n}\n",
|
"a, b {\n a, b {\n color: red\n}\n}\n",
|
||||||
"a a, a b, b a, b b {\n color: red;\n}\n"
|
"a a, a b, b a, b b {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_element, "a {\n color: red;\n}\n");
|
test!(
|
||||||
test!(selector_id, "#id {\n color: red;\n}\n");
|
selector_element,
|
||||||
test!(selector_class, ".class {\n color: red;\n}\n");
|
"a {\n color: red;\n}\n",
|
||||||
test!(selector_el_descendant, "a a {\n color: red;\n}\n");
|
"a {\n color: red;\n}\n"
|
||||||
test!(selector_universal, "* {\n color: red;\n}\n");
|
);
|
||||||
test!(selector_el_class_and, "a.class {\n color: red;\n}\n");
|
test!(
|
||||||
test!(selector_el_id_and, "a#class {\n color: red;\n}\n");
|
selector_id,
|
||||||
|
"#id {\n color: red;\n}\n",
|
||||||
|
"#id {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_class,
|
||||||
|
".class {\n color: red;\n}\n",
|
||||||
|
".class {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_el_descendant,
|
||||||
|
"a a {\n color: red;\n}\n",
|
||||||
|
"a a {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_universal,
|
||||||
|
"* {\n color: red;\n}\n",
|
||||||
|
"* {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_el_class_and,
|
||||||
|
"a.class {\n color: red;\n}\n",
|
||||||
|
"a.class {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_el_id_and,
|
||||||
|
"a#class {\n color: red;\n}\n",
|
||||||
|
"a#class {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_class_descendant,
|
selector_el_class_descendant,
|
||||||
|
"a .class {\n color: red;\n}\n",
|
||||||
"a .class {\n color: red;\n}\n"
|
"a .class {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_el_id_descendant, "a #class {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_el_id_descendant,
|
||||||
|
"a #class {\n color: red;\n}\n",
|
||||||
|
"a #class {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_universal_descendant,
|
selector_el_universal_descendant,
|
||||||
|
"a * {\n color: red;\n}\n",
|
||||||
"a * {\n color: red;\n}\n"
|
"a * {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_universal_el_descendant,
|
selector_universal_el_descendant,
|
||||||
|
"* a {\n color: red;\n}\n",
|
||||||
"* a {\n color: red;\n}\n"
|
"* a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
test!(selector_attribute_any, "[attr] {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_attribute_any,
|
||||||
|
"[attr] {\n color: red;\n}\n",
|
||||||
|
"[attr] {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_any_lower_case_insensitive,
|
selector_attribute_any_lower_case_insensitive,
|
||||||
|
"[attr=val i] {\n color: red;\n}\n",
|
||||||
"[attr=val i] {\n color: red;\n}\n"
|
"[attr=val i] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -39,18 +79,22 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_any_upper_case_insensitive,
|
selector_attribute_any_upper_case_insensitive,
|
||||||
|
"[attr=val I] {\n color: red;\n}\n",
|
||||||
"[attr=val I] {\n color: red;\n}\n"
|
"[attr=val I] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_arbitrary_modifier,
|
selector_attribute_arbitrary_modifier,
|
||||||
|
"[attr=val c] {\n color: red;\n}\n",
|
||||||
"[attr=val c] {\n color: red;\n}\n"
|
"[attr=val c] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_i_in_attr,
|
selector_attribute_i_in_attr,
|
||||||
|
"[atitr=val] {\n color: red;\n}\n",
|
||||||
"[atitr=val] {\n color: red;\n}\n"
|
"[atitr=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_i_in_val,
|
selector_attribute_i_in_val,
|
||||||
|
"[attr=vail] {\n color: red;\n}\n",
|
||||||
"[attr=vail] {\n color: red;\n}\n"
|
"[attr=vail] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -60,6 +104,7 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_equals,
|
selector_attribute_equals,
|
||||||
|
"[attr=val] {\n color: red;\n}\n",
|
||||||
"[attr=val] {\n color: red;\n}\n"
|
"[attr=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -74,10 +119,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_quotes_non_ident,
|
selector_attribute_quotes_non_ident,
|
||||||
|
"[attr=\"1\"] {\n color: red;\n}\n",
|
||||||
"[attr=\"1\"] {\n color: red;\n}\n"
|
"[attr=\"1\"] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_quotes_custom_property,
|
selector_attribute_quotes_custom_property,
|
||||||
|
"[attr=\"--foo\"] {\n color: red;\n}\n",
|
||||||
"[attr=\"--foo\"] {\n color: red;\n}\n"
|
"[attr=\"--foo\"] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -87,10 +134,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_quoted_escape,
|
selector_attribute_quoted_escape,
|
||||||
|
"[attr=\"v\\al\"] {\n color: red;\n}\n",
|
||||||
"[attr=\"v\\al\"] {\n color: red;\n}\n"
|
"[attr=\"v\\al\"] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_namespace,
|
selector_attribute_namespace,
|
||||||
|
"[*|foo] {\n color: red;\n}\n",
|
||||||
"[*|foo] {\n color: red;\n}\n"
|
"[*|foo] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
error!(
|
error!(
|
||||||
@ -99,32 +148,46 @@ error!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_maintains_quotes_around_invalid_identifier,
|
selector_attribute_maintains_quotes_around_invalid_identifier,
|
||||||
|
"[attr=\"val.\"] {\n color: red;\n}\n",
|
||||||
"[attr=\"val.\"] {\n color: red;\n}\n"
|
"[attr=\"val.\"] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
error!(
|
error!(
|
||||||
attribute_attr_quoted,
|
attribute_attr_quoted,
|
||||||
"[\"attr\"=val] {\n color: red;\n}\n", "Error: Expected identifier."
|
"[\"attr\"=val] {\n color: red;\n}\n", "Error: Expected identifier."
|
||||||
);
|
);
|
||||||
test!(selector_attribute_in, "[attr~=val] {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_attribute_in,
|
||||||
|
"[attr~=val] {\n color: red;\n}\n",
|
||||||
|
"[attr~=val] {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_begins_hyphen_or_exact,
|
selector_attribute_begins_hyphen_or_exact,
|
||||||
|
"[attr|=val] {\n color: red;\n}\n",
|
||||||
"[attr|=val] {\n color: red;\n}\n"
|
"[attr|=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_starts_with,
|
selector_attribute_starts_with,
|
||||||
|
"[attr^=val] {\n color: red;\n}\n",
|
||||||
"[attr^=val] {\n color: red;\n}\n"
|
"[attr^=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_ends_with,
|
selector_attribute_ends_with,
|
||||||
|
"[attr$=val] {\n color: red;\n}\n",
|
||||||
"[attr$=val] {\n color: red;\n}\n"
|
"[attr$=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_attribute_contains,
|
selector_attribute_contains,
|
||||||
|
"[attr*=val] {\n color: red;\n}\n",
|
||||||
"[attr*=val] {\n color: red;\n}\n"
|
"[attr*=val] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_el_attribute_and, "a[attr] {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_el_attribute_and,
|
||||||
|
"a[attr] {\n color: red;\n}\n",
|
||||||
|
"a[attr] {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_attribute_descendant,
|
selector_el_attribute_descendant,
|
||||||
|
"a [attr] {\n color: red;\n}\n",
|
||||||
"a [attr] {\n color: red;\n}\n"
|
"a [attr] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -132,42 +195,74 @@ test!(
|
|||||||
"a {\n [#{&}] {\n color: red;\n }\n}\n",
|
"a {\n [#{&}] {\n color: red;\n }\n}\n",
|
||||||
"a [a] {\n color: red;\n}\n"
|
"a [a] {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_el_mul_el, "a, b {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_el_mul_el,
|
||||||
|
"a, b {\n color: red;\n}\n",
|
||||||
|
"a, b {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_immediate_child_el,
|
selector_el_immediate_child_el,
|
||||||
|
"a > b {\n color: red;\n}\n",
|
||||||
"a > b {\n color: red;\n}\n"
|
"a > b {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_el_following_el, "a + b {\n color: red;\n}\n");
|
test!(
|
||||||
test!(selector_el_preceding_el, "a ~ b {\n color: red;\n}\n");
|
selector_el_following_el,
|
||||||
test!(selector_pseudo, ":pseudo {\n color: red;\n}\n");
|
"a + b {\n color: red;\n}\n",
|
||||||
test!(selector_el_and_pseudo, "a:pseudo {\n color: red;\n}\n");
|
"a + b {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_el_preceding_el,
|
||||||
|
"a ~ b {\n color: red;\n}\n",
|
||||||
|
"a ~ b {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_pseudo,
|
||||||
|
":pseudo {\n color: red;\n}\n",
|
||||||
|
":pseudo {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
selector_el_and_pseudo,
|
||||||
|
"a:pseudo {\n color: red;\n}\n",
|
||||||
|
"a:pseudo {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_pseudo_descendant,
|
selector_el_pseudo_descendant,
|
||||||
|
"a :pseudo {\n color: red;\n}\n",
|
||||||
"a :pseudo {\n color: red;\n}\n"
|
"a :pseudo {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_pseudo_el_descendant,
|
selector_pseudo_el_descendant,
|
||||||
|
":pseudo a {\n color: red;\n}\n",
|
||||||
":pseudo a {\n color: red;\n}\n"
|
":pseudo a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_pseudoelement, "::before {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_pseudoelement,
|
||||||
|
"::before {\n color: red;\n}\n",
|
||||||
|
"::before {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_and_pseudoelement,
|
selector_el_and_pseudoelement,
|
||||||
|
"a::before {\n color: red;\n}\n",
|
||||||
"a::before {\n color: red;\n}\n"
|
"a::before {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_pseudoelement_descendant,
|
selector_el_pseudoelement_descendant,
|
||||||
|
"a ::before {\n color: red;\n}\n",
|
||||||
"a ::before {\n color: red;\n}\n"
|
"a ::before {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_pseudoelement_el_descendant,
|
selector_pseudoelement_el_descendant,
|
||||||
|
"::before a {\n color: red;\n}\n",
|
||||||
"::before a {\n color: red;\n}\n"
|
"::before a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_pseudo_paren_comma,
|
selector_pseudo_paren_comma,
|
||||||
|
":pseudo(a, b, c) {\n color: red;\n}\n",
|
||||||
":pseudo(a, b, c) {\n color: red;\n}\n"
|
":pseudo(a, b, c) {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_pseudo_paren_space,
|
selector_pseudo_paren_space,
|
||||||
|
":pseudo(a b c) {\n color: red;\n}\n",
|
||||||
":pseudo(a b c) {\n color: red;\n}\n"
|
":pseudo(a b c) {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -177,14 +272,17 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_pseudo_paren_and,
|
selector_el_pseudo_paren_and,
|
||||||
|
"a:pseudo(a, b, c) {\n color: red;\n}\n",
|
||||||
"a:pseudo(a, b, c) {\n color: red;\n}\n"
|
"a:pseudo(a, b, c) {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_el_pseudo_paren_descendant,
|
selector_el_pseudo_paren_descendant,
|
||||||
|
"a :pseudo(a, b, c) {\n color: red;\n}\n",
|
||||||
"a :pseudo(a, b, c) {\n color: red;\n}\n"
|
"a :pseudo(a, b, c) {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
selector_pseudo_paren_el_descendant,
|
selector_pseudo_paren_el_descendant,
|
||||||
|
":pseudo(a, b, c) a {\n color: red;\n}\n",
|
||||||
":pseudo(a, b, c) a {\n color: red;\n}\n"
|
":pseudo(a, b, c) a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -192,7 +290,11 @@ test!(
|
|||||||
"a {\n :pseudo(a, b, c) {\n color: red;\n }\n}\n",
|
"a {\n :pseudo(a, b, c) {\n color: red;\n }\n}\n",
|
||||||
"a :pseudo(a, b, c) {\n color: red;\n}\n"
|
"a :pseudo(a, b, c) {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(selector_mul, "a, b {\n color: red;\n}\n");
|
test!(
|
||||||
|
selector_mul,
|
||||||
|
"a, b {\n color: red;\n}\n",
|
||||||
|
"a, b {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
outer_ampersand,
|
outer_ampersand,
|
||||||
"a, b {\n& c {\n color: red;\n}\n}\n",
|
"a, b {\n& c {\n color: red;\n}\n}\n",
|
||||||
@ -298,7 +400,11 @@ test!(
|
|||||||
"a {\n + {\n b {\n color: red;\n }\n}\n",
|
"a {\n + {\n b {\n color: red;\n }\n}\n",
|
||||||
"a + b {\n color: red;\n}\n"
|
"a + b {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(simple_multiple_newline, "a,\nb {\n color: red;\n}\n");
|
test!(
|
||||||
|
simple_multiple_newline,
|
||||||
|
"a,\nb {\n color: red;\n}\n",
|
||||||
|
"a,\nb {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
nested_multiple_newline,
|
nested_multiple_newline,
|
||||||
"a,\nb {\n c {\n color: blue;\n }\n color: red;\n}\n",
|
"a,\nb {\n c {\n color: blue;\n }\n color: red;\n}\n",
|
||||||
@ -335,8 +441,16 @@ test!(
|
|||||||
"#{&} a {\n color: red;\n}\n",
|
"#{&} a {\n color: red;\n}\n",
|
||||||
"a {\n color: red;\n}\n"
|
"a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(allows_id_start_with_number, "#2foo {\n color: red;\n}\n");
|
test!(
|
||||||
test!(allows_id_only_number, "#2 {\n color: red;\n}\n");
|
allows_id_start_with_number,
|
||||||
|
"#2foo {\n color: red;\n}\n",
|
||||||
|
"#2foo {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
allows_id_only_number,
|
||||||
|
"#2 {\n color: red;\n}\n",
|
||||||
|
"#2 {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
id_interpolation,
|
id_interpolation,
|
||||||
"$zzz: zzz;\n##{$zzz} {\n a: b;\n}\n",
|
"$zzz: zzz;\n##{$zzz} {\n a: b;\n}\n",
|
||||||
@ -347,7 +461,11 @@ test!(
|
|||||||
"$bar: \"#foo\";\nul li#{$bar} {\n foo: bar;\n}\n",
|
"$bar: \"#foo\";\nul li#{$bar} {\n foo: bar;\n}\n",
|
||||||
"ul li#foo {\n foo: bar;\n}\n"
|
"ul li#foo {\n foo: bar;\n}\n"
|
||||||
);
|
);
|
||||||
test!(escaped_space, "a\\ b {\n color: foo;\n}\n");
|
test!(
|
||||||
|
escaped_space,
|
||||||
|
"a\\ b {\n color: foo;\n}\n",
|
||||||
|
"a\\ b {\n color: foo;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
escaped_bang,
|
escaped_bang,
|
||||||
"\\! {\n color: red;\n}\n",
|
"\\! {\n color: red;\n}\n",
|
||||||
@ -355,6 +473,7 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
multiple_consecutive_immediate_child,
|
multiple_consecutive_immediate_child,
|
||||||
|
"> > foo {\n color: foo;\n}\n",
|
||||||
"> > foo {\n color: foo;\n}\n"
|
"> > foo {\n color: foo;\n}\n"
|
||||||
);
|
);
|
||||||
error!(
|
error!(
|
||||||
@ -418,6 +537,7 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
touching_universal_stays_the_same,
|
touching_universal_stays_the_same,
|
||||||
|
"a* {\n color: red;\n}\n",
|
||||||
"a* {\n color: red;\n}\n"
|
"a* {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
|
@ -13,10 +13,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
calc_multiple_args,
|
calc_multiple_args,
|
||||||
|
"a {\n color: calc(1, 2, a, b, c);\n}\n",
|
||||||
"a {\n color: calc(1, 2, a, b, c);\n}\n"
|
"a {\n color: calc(1, 2, a, b, c);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
calc_does_not_evaluate_arithmetic,
|
calc_does_not_evaluate_arithmetic,
|
||||||
|
"a {\n color: calc(1 + 2);\n}\n",
|
||||||
"a {\n color: calc(1 + 2);\n}\n"
|
"a {\n color: calc(1 + 2);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -24,14 +26,24 @@ test!(
|
|||||||
"a {\n color: calc(#{1 + 2});\n}\n",
|
"a {\n color: calc(#{1 + 2});\n}\n",
|
||||||
"a {\n color: calc(3);\n}\n"
|
"a {\n color: calc(3);\n}\n"
|
||||||
);
|
);
|
||||||
test!(calc_retains_silent_comment, "a {\n color: calc(//);\n}\n");
|
test!(
|
||||||
|
calc_retains_silent_comment,
|
||||||
|
"a {\n color: calc(//);\n}\n",
|
||||||
|
"a {\n color: calc(//);\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
calc_retains_multiline_comment,
|
calc_retains_multiline_comment,
|
||||||
|
"a {\n color: calc(/**/);\n}\n",
|
||||||
"a {\n color: calc(/**/);\n}\n"
|
"a {\n color: calc(/**/);\n}\n"
|
||||||
);
|
);
|
||||||
test!(calc_nested_parens, "a {\n color: calc((((()))));\n}\n");
|
test!(
|
||||||
|
calc_nested_parens,
|
||||||
|
"a {\n color: calc((((()))));\n}\n",
|
||||||
|
"a {\n color: calc((((()))));\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
calc_invalid_arithmetic,
|
calc_invalid_arithmetic,
|
||||||
|
"a {\n color: calc(2px + 2px + 5%);\n}\n",
|
||||||
"a {\n color: calc(2px + 2px + 5%);\n}\n"
|
"a {\n color: calc(2px + 2px + 5%);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -81,10 +93,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
element_multiple_args,
|
element_multiple_args,
|
||||||
|
"a {\n color: element(1, 2, a, b, c);\n}\n",
|
||||||
"a {\n color: element(1, 2, a, b, c);\n}\n"
|
"a {\n color: element(1, 2, a, b, c);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
element_does_not_evaluate_arithmetic,
|
element_does_not_evaluate_arithmetic,
|
||||||
|
"a {\n color: element(1 + 2);\n}\n",
|
||||||
"a {\n color: element(1 + 2);\n}\n"
|
"a {\n color: element(1 + 2);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -94,14 +108,17 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
element_retains_silent_comment,
|
element_retains_silent_comment,
|
||||||
|
"a {\n color: element(//);\n}\n",
|
||||||
"a {\n color: element(//);\n}\n"
|
"a {\n color: element(//);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
element_retains_multiline_comment,
|
element_retains_multiline_comment,
|
||||||
|
"a {\n color: element(/**/);\n}\n",
|
||||||
"a {\n color: element(/**/);\n}\n"
|
"a {\n color: element(/**/);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
element_nested_parens,
|
element_nested_parens,
|
||||||
|
"a {\n color: element((((()))));\n}\n",
|
||||||
"a {\n color: element((((()))));\n}\n"
|
"a {\n color: element((((()))));\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -121,10 +138,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
expression_multiple_args,
|
expression_multiple_args,
|
||||||
|
"a {\n color: expression(1, 2, a, b, c);\n}\n",
|
||||||
"a {\n color: expression(1, 2, a, b, c);\n}\n"
|
"a {\n color: expression(1, 2, a, b, c);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
expression_does_not_evaluate_arithmetic,
|
expression_does_not_evaluate_arithmetic,
|
||||||
|
"a {\n color: expression(1 + 2);\n}\n",
|
||||||
"a {\n color: expression(1 + 2);\n}\n"
|
"a {\n color: expression(1 + 2);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -134,14 +153,17 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
expression_retains_silent_comment,
|
expression_retains_silent_comment,
|
||||||
|
"a {\n color: expression(//);\n}\n",
|
||||||
"a {\n color: expression(//);\n}\n"
|
"a {\n color: expression(//);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
expression_retains_multiline_comment,
|
expression_retains_multiline_comment,
|
||||||
|
"a {\n color: expression(/**/);\n}\n",
|
||||||
"a {\n color: expression(/**/);\n}\n"
|
"a {\n color: expression(/**/);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
expression_nested_parens,
|
expression_nested_parens,
|
||||||
|
"a {\n color: expression((((()))));\n}\n",
|
||||||
"a {\n color: expression((((()))));\n}\n"
|
"a {\n color: expression((((()))));\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -161,10 +183,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
progid_multiple_args,
|
progid_multiple_args,
|
||||||
|
"a {\n color: progid:(1, 2, a, b, c);\n}\n",
|
||||||
"a {\n color: progid:(1, 2, a, b, c);\n}\n"
|
"a {\n color: progid:(1, 2, a, b, c);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
progid_does_not_evaluate_arithmetic,
|
progid_does_not_evaluate_arithmetic,
|
||||||
|
"a {\n color: progid:(1 + 2);\n}\n",
|
||||||
"a {\n color: progid:(1 + 2);\n}\n"
|
"a {\n color: progid:(1 + 2);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -174,18 +198,22 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
progid_retains_silent_comment,
|
progid_retains_silent_comment,
|
||||||
|
"a {\n color: progid:(//);\n}\n",
|
||||||
"a {\n color: progid:(//);\n}\n"
|
"a {\n color: progid:(//);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
progid_retains_multiline_comment,
|
progid_retains_multiline_comment,
|
||||||
|
"a {\n color: progid:(/**/);\n}\n",
|
||||||
"a {\n color: progid:(/**/);\n}\n"
|
"a {\n color: progid:(/**/);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
progid_nested_parens,
|
progid_nested_parens,
|
||||||
|
"a {\n color: progid:((((()))));\n}\n",
|
||||||
"a {\n color: progid:((((()))));\n}\n"
|
"a {\n color: progid:((((()))));\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
progid_values_after_colon,
|
progid_values_after_colon,
|
||||||
|
"a {\n color: progid:apple.bottoM..jeans.boots();\n}\n",
|
||||||
"a {\n color: progid:apple.bottoM..jeans.boots();\n}\n"
|
"a {\n color: progid:apple.bottoM..jeans.boots();\n}\n"
|
||||||
);
|
);
|
||||||
error!(
|
error!(
|
||||||
|
@ -76,8 +76,16 @@ test!(
|
|||||||
"a {\n color: blu\\65;\n}\n",
|
"a {\n color: blu\\65;\n}\n",
|
||||||
"a {\n color: blue;\n}\n"
|
"a {\n color: blue;\n}\n"
|
||||||
);
|
);
|
||||||
test!(double_escape_is_preserved, "a {\n color: r\\\\65;\n}\n");
|
test!(
|
||||||
test!(semicolon_in_string, "a {\n color: \";\";\n}\n");
|
double_escape_is_preserved,
|
||||||
|
"a {\n color: r\\\\65;\n}\n",
|
||||||
|
"a {\n color: r\\\\65;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
semicolon_in_string,
|
||||||
|
"a {\n color: \";\";\n}\n",
|
||||||
|
"a {\n color: \";\";\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
single_character_escape_sequence_has_space,
|
single_character_escape_sequence_has_space,
|
||||||
"a {\n color: \\fg1;\n}\n",
|
"a {\n color: \\fg1;\n}\n",
|
||||||
@ -133,7 +141,11 @@ test!(
|
|||||||
"a {\n color: quote(\\b);\n}\n",
|
"a {\n color: quote(\\b);\n}\n",
|
||||||
"a {\n color: \"\\\\b \";\n}\n"
|
"a {\n color: \"\\\\b \";\n}\n"
|
||||||
);
|
);
|
||||||
test!(escaped_backslash, "a {\n color: \"\\\\\";\n}\n");
|
test!(
|
||||||
|
escaped_backslash,
|
||||||
|
"a {\n color: \"\\\\\";\n}\n",
|
||||||
|
"a {\n color: \"\\\\\";\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
double_quotes_when_containing_single_quote,
|
double_quotes_when_containing_single_quote,
|
||||||
"a {\n color: '\\\'';\n}\n",
|
"a {\n color: '\\\'';\n}\n",
|
||||||
@ -141,14 +153,17 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
allows_escaped_quote_at_start_of_ident,
|
allows_escaped_quote_at_start_of_ident,
|
||||||
|
"a {\n color: \\\"c\\\";\n}\n",
|
||||||
"a {\n color: \\\"c\\\";\n}\n"
|
"a {\n color: \\\"c\\\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
quoted_escaped_newline_unchanged,
|
quoted_escaped_newline_unchanged,
|
||||||
|
"a {\n color: \"\\a\";\n}\n",
|
||||||
"a {\n color: \"\\a\";\n}\n"
|
"a {\n color: \"\\a\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
unquoted_escape_minus_unquoted,
|
unquoted_escape_minus_unquoted,
|
||||||
|
"a {\n color: \\a - foo;\n}\n",
|
||||||
"a {\n color: \\a - foo;\n}\n"
|
"a {\n color: \\a - foo;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
|
@ -234,4 +234,8 @@ test!(
|
|||||||
"a {\n color: str-insert($string: \"foo\", $insert: \"X\", $index: -99999999999999999999);\n}\n",
|
"a {\n color: str-insert($string: \"foo\", $insert: \"X\", $index: -99999999999999999999);\n}\n",
|
||||||
"a {\n color: \"Xfoo\";\n}\n"
|
"a {\n color: \"Xfoo\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(hash_in_string, "a {\n color: \"#foo\";\n}\n");
|
test!(
|
||||||
|
hash_in_string,
|
||||||
|
"a {\n color: \"#foo\";\n}\n",
|
||||||
|
"a {\n color: \"#foo\";\n}\n"
|
||||||
|
);
|
||||||
|
@ -1,8 +1,16 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
test!(basic_style, "a {\n color: red;\n}\n");
|
test!(
|
||||||
test!(two_styles, "a {\n color: red;\n color: blue;\n}\n");
|
basic_style,
|
||||||
|
"a {\n color: red;\n}\n",
|
||||||
|
"a {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
two_styles,
|
||||||
|
"a {\n color: red;\n color: blue;\n}\n",
|
||||||
|
"a {\n color: red;\n color: blue;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
two_inner_rulesets,
|
two_inner_rulesets,
|
||||||
"a {\n b {\n color: red;\n}\n c {\n color: white;\n}\n}\n",
|
"a {\n b {\n color: red;\n}\n c {\n color: white;\n}\n}\n",
|
||||||
@ -10,6 +18,7 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
two_rulesets,
|
two_rulesets,
|
||||||
|
"a {\n color: red;\n}\n\nc {\n color: white;\n}\n",
|
||||||
"a {\n color: red;\n}\n\nc {\n color: white;\n}\n"
|
"a {\n color: red;\n}\n\nc {\n color: white;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -38,10 +47,19 @@ test!(
|
|||||||
"a {\n color: red\n blue;\n}\n",
|
"a {\n color: red\n blue;\n}\n",
|
||||||
"a {\n color: red blue;\n}\n"
|
"a {\n color: red blue;\n}\n"
|
||||||
);
|
);
|
||||||
test!(hyphenated_style_property, "a {\n font-family: Arial;\n}\n");
|
test!(
|
||||||
test!(hyphenated_style_value, "a {\n color: Open-Sans;\n}\n");
|
hyphenated_style_property,
|
||||||
|
"a {\n font-family: Arial;\n}\n",
|
||||||
|
"a {\n font-family: Arial;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
hyphenated_style_value,
|
||||||
|
"a {\n color: Open-Sans;\n}\n",
|
||||||
|
"a {\n color: Open-Sans;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
space_separated_style_value,
|
space_separated_style_value,
|
||||||
|
"a {\n border: solid red;\n}\n",
|
||||||
"a {\n border: solid red;\n}\n"
|
"a {\n border: solid red;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -51,10 +69,12 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
double_quoted_style_value,
|
double_quoted_style_value,
|
||||||
|
"a {\n font: \"Open-Sans\";\n}\n",
|
||||||
"a {\n font: \"Open-Sans\";\n}\n"
|
"a {\n font: \"Open-Sans\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
comma_style_value,
|
comma_style_value,
|
||||||
|
"a {\n font: Open-Sans, sans-serif;\n}\n",
|
||||||
"a {\n font: Open-Sans, sans-serif;\n}\n"
|
"a {\n font: Open-Sans, sans-serif;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -148,7 +168,11 @@ test!(
|
|||||||
"foo {\n a: b {\n c: d {\n e: f;\n }\n }\n}\n",
|
"foo {\n a: b {\n c: d {\n e: f;\n }\n }\n}\n",
|
||||||
"foo {\n a: b;\n a-c: d;\n a-c-e: f;\n}\n"
|
"foo {\n a: b;\n a-c: d;\n a-c-e: f;\n}\n"
|
||||||
);
|
);
|
||||||
test!(curly_braces_in_quotes, "a {\n color: \"{foo}\";\n}\n");
|
test!(
|
||||||
|
curly_braces_in_quotes,
|
||||||
|
"a {\n color: \"{foo}\";\n}\n",
|
||||||
|
"a {\n color: \"{foo}\";\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
escaped_interpolation,
|
escaped_interpolation,
|
||||||
"a {\n color: \"\\#{foo}\";\n}\n",
|
"a {\n color: \"\\#{foo}\";\n}\n",
|
||||||
@ -156,6 +180,7 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
styles_after_quoted,
|
styles_after_quoted,
|
||||||
|
"a {\n color: \"red\";\n color: blue;\n}\n",
|
||||||
"a {\n color: \"red\";\n color: blue;\n}\n"
|
"a {\n color: \"red\";\n color: blue;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
|
@ -1,19 +1,31 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
test!(unary_pos_unquoted_ident, "a {\n color: +foo;\n}\n");
|
test!(
|
||||||
|
unary_pos_unquoted_ident,
|
||||||
|
"a {\n color: +foo;\n}\n",
|
||||||
|
"a {\n color: +foo;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
unary_pos_whitespace,
|
unary_pos_whitespace,
|
||||||
"a {\n color: + foo;\n}\n",
|
"a {\n color: + foo;\n}\n",
|
||||||
"a {\n color: +foo;\n}\n"
|
"a {\n color: +foo;\n}\n"
|
||||||
);
|
);
|
||||||
test!(unary_pos_dblquoted_ident, "a {\n color: +\"foo\";\n}\n");
|
test!(
|
||||||
|
unary_pos_dblquoted_ident,
|
||||||
|
"a {\n color: +\"foo\";\n}\n",
|
||||||
|
"a {\n color: +\"foo\";\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
unary_pos_sglquoted_ident,
|
unary_pos_sglquoted_ident,
|
||||||
"a {\n color: +'foo';\n}\n",
|
"a {\n color: +'foo';\n}\n",
|
||||||
"a {\n color: +\"foo\";\n}\n"
|
"a {\n color: +\"foo\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(unary_pos_color, "a {\n color: +\"foo\";\n}\n");
|
test!(
|
||||||
|
unary_pos_color,
|
||||||
|
"a {\n color: +\"foo\";\n}\n",
|
||||||
|
"a {\n color: +\"foo\";\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
unary_pos_number_unit,
|
unary_pos_number_unit,
|
||||||
"a {\n color: +1px;\n}\n",
|
"a {\n color: +1px;\n}\n",
|
||||||
@ -29,15 +41,31 @@ test!(
|
|||||||
"a {\n color: bar,+ \"bar\" - foo;\n}\n",
|
"a {\n color: bar,+ \"bar\" - foo;\n}\n",
|
||||||
"a {\n color: bar, +\"bar\"-foo;\n}\n"
|
"a {\n color: bar, +\"bar\"-foo;\n}\n"
|
||||||
);
|
);
|
||||||
test!(unary_neg_unquoted_ident, "a {\n color: -foo;\n}\n");
|
test!(
|
||||||
test!(unary_neg_dblquoted_ident, "a {\n color: -\"foo\";\n}\n");
|
unary_neg_unquoted_ident,
|
||||||
|
"a {\n color: -foo;\n}\n",
|
||||||
|
"a {\n color: -foo;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
unary_neg_dblquoted_ident,
|
||||||
|
"a {\n color: -\"foo\";\n}\n",
|
||||||
|
"a {\n color: -\"foo\";\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
unary_neg_sglquoted_ident,
|
unary_neg_sglquoted_ident,
|
||||||
"a {\n color: -'foo';\n}\n",
|
"a {\n color: -'foo';\n}\n",
|
||||||
"a {\n color: -\"foo\";\n}\n"
|
"a {\n color: -\"foo\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(unary_neg_color, "a {\n color: -\"foo\";\n}\n");
|
test!(
|
||||||
test!(unary_neg_number, "a {\n color: -1px;\n}\n");
|
unary_neg_color,
|
||||||
|
"a {\n color: -\"foo\";\n}\n",
|
||||||
|
"a {\n color: -\"foo\";\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
unary_neg_number,
|
||||||
|
"a {\n color: -1px;\n}\n",
|
||||||
|
"a {\n color: -1px;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
unary_neg_whitespace,
|
unary_neg_whitespace,
|
||||||
"a {\n color: - 1px;\n}\n",
|
"a {\n color: - 1px;\n}\n",
|
||||||
@ -58,4 +86,8 @@ test!(
|
|||||||
"a {\n color: -(null);\n}\n",
|
"a {\n color: -(null);\n}\n",
|
||||||
"a {\n color: -;\n}\n"
|
"a {\n color: -;\n}\n"
|
||||||
);
|
);
|
||||||
test!(negative_null_as_ident, "a {\n color: -null;\n}\n");
|
test!(
|
||||||
|
negative_null_as_ident,
|
||||||
|
"a {\n color: -null;\n}\n",
|
||||||
|
"a {\n color: -null;\n}\n"
|
||||||
|
);
|
||||||
|
@ -1,12 +1,36 @@
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod macros;
|
mod macros;
|
||||||
|
|
||||||
test!(unit_none, "a {\n height: 1;\n}\n");
|
test!(
|
||||||
test!(unit_not_attached, "a {\n height: 1 px;\n}\n");
|
unit_none,
|
||||||
test!(unit_px, "a {\n height: 1px;\n}\n");
|
"a {\n height: 1;\n}\n",
|
||||||
test!(unit_em, "a {\n height: 1em;\n}\n");
|
"a {\n height: 1;\n}\n"
|
||||||
test!(unit_rem, "a {\n height: 1rem;\n}\n");
|
);
|
||||||
test!(unit_percent, "a {\n height: 1%;\n}\n");
|
test!(
|
||||||
|
unit_not_attached,
|
||||||
|
"a {\n height: 1 px;\n}\n",
|
||||||
|
"a {\n height: 1 px;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
unit_px,
|
||||||
|
"a {\n height: 1px;\n}\n",
|
||||||
|
"a {\n height: 1px;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
unit_em,
|
||||||
|
"a {\n height: 1em;\n}\n",
|
||||||
|
"a {\n height: 1em;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
unit_rem,
|
||||||
|
"a {\n height: 1rem;\n}\n",
|
||||||
|
"a {\n height: 1rem;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
unit_percent,
|
||||||
|
"a {\n height: 1%;\n}\n",
|
||||||
|
"a {\n height: 1%;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
unit_times_none,
|
unit_times_none,
|
||||||
"a {\n color: 3px * 2;\n}\n",
|
"a {\n color: 3px * 2;\n}\n",
|
||||||
|
@ -3,10 +3,15 @@ mod macros;
|
|||||||
|
|
||||||
test!(
|
test!(
|
||||||
basic_unknown_at_rule,
|
basic_unknown_at_rule,
|
||||||
|
"@foo {\n a {\n color: red;\n }\n}\n",
|
||||||
"@foo {\n a {\n color: red;\n }\n}\n"
|
"@foo {\n a {\n color: red;\n }\n}\n"
|
||||||
);
|
);
|
||||||
test!(unknown_at_rule_no_selector, "@foo {\n color: red;\n}\n");
|
test!(
|
||||||
test!(unknown_at_rule_no_body, "@foo;\n");
|
unknown_at_rule_no_selector,
|
||||||
|
"@foo {\n color: red;\n}\n",
|
||||||
|
"@foo {\n color: red;\n}\n"
|
||||||
|
);
|
||||||
|
test!(unknown_at_rule_no_body, "@foo;\n", "@foo;\n");
|
||||||
test!(unknown_at_rule_no_body_eof, "@foo", "@foo;\n");
|
test!(unknown_at_rule_no_body_eof, "@foo", "@foo;\n");
|
||||||
test!(
|
test!(
|
||||||
unknown_at_rule_interpolated_eof_no_body,
|
unknown_at_rule_interpolated_eof_no_body,
|
||||||
|
34
tests/url.rs
34
tests/url.rs
@ -43,13 +43,19 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
silent_comment,
|
silent_comment,
|
||||||
|
"a {\n color: url(//some/absolute/path);\n}\n",
|
||||||
"a {\n color: url(//some/absolute/path);\n}\n"
|
"a {\n color: url(//some/absolute/path);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
multiline_comment,
|
multiline_comment,
|
||||||
|
"a {\n color: url(/*looks-like-a*/comment);\n}\n",
|
||||||
"a {\n color: url(/*looks-like-a*/comment);\n}\n"
|
"a {\n color: url(/*looks-like-a*/comment);\n}\n"
|
||||||
);
|
);
|
||||||
test!(plain_css_function, "a {\n color: url(fn(\"s\"));\n}\n");
|
test!(
|
||||||
|
plain_css_function,
|
||||||
|
"a {\n color: url(fn(\"s\"));\n}\n",
|
||||||
|
"a {\n color: url(fn(\"s\"));\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
builtin_function,
|
builtin_function,
|
||||||
"a {\n color: url(if(true, \"red.png\", \"blue.png\"));\n}\n",
|
"a {\n color: url(if(true, \"red.png\", \"blue.png\"));\n}\n",
|
||||||
@ -70,10 +76,19 @@ test!(
|
|||||||
"a {\n color: url(\"hello-#{world}.png\");\n}\n",
|
"a {\n color: url(\"hello-#{world}.png\");\n}\n",
|
||||||
"a {\n color: url(\"hello-world.png\");\n}\n"
|
"a {\n color: url(\"hello-world.png\");\n}\n"
|
||||||
);
|
);
|
||||||
test!(simple_forward_slash, "a {\n color: url(foo/bar.css);\n}\n");
|
test!(
|
||||||
test!(http_url, "a {\n color: url(http://foo.bar.com);\n}\n");
|
simple_forward_slash,
|
||||||
|
"a {\n color: url(foo/bar.css);\n}\n",
|
||||||
|
"a {\n color: url(foo/bar.css);\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
http_url,
|
||||||
|
"a {\n color: url(http://foo.bar.com);\n}\n",
|
||||||
|
"a {\n color: url(http://foo.bar.com);\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
google_fonts_url,
|
google_fonts_url,
|
||||||
|
"a {\n color: url(http://fonts.googleapis.com/css?family=Karla:400,700,400italic|Anonymous+Pro:400,700,400italic);\n}\n",
|
||||||
"a {\n color: url(http://fonts.googleapis.com/css?family=Karla:400,700,400italic|Anonymous+Pro:400,700,400italic);\n}\n"
|
"a {\n color: url(http://fonts.googleapis.com/css?family=Karla:400,700,400italic|Anonymous+Pro:400,700,400italic);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -83,6 +98,7 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
many_forward_slashes,
|
many_forward_slashes,
|
||||||
|
"a {\n color: url(http://box_////fudge.css);\n}\n",
|
||||||
"a {\n color: url(http://box_////fudge.css);\n}\n"
|
"a {\n color: url(http://box_////fudge.css);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -95,7 +111,11 @@ test!(
|
|||||||
"a {\n color: url(\n);\n}\n",
|
"a {\n color: url(\n);\n}\n",
|
||||||
"a {\n color: url();\n}\n"
|
"a {\n color: url();\n}\n"
|
||||||
);
|
);
|
||||||
test!(url_comma_list, "a {\n color: url(1, 2, a, b, c);\n}\n");
|
test!(
|
||||||
|
url_comma_list,
|
||||||
|
"a {\n color: url(1, 2, a, b, c);\n}\n",
|
||||||
|
"a {\n color: url(1, 2, a, b, c);\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
url_contains_only_interpolation,
|
url_contains_only_interpolation,
|
||||||
"a {\n color: url(#{1 + 2});\n}\n",
|
"a {\n color: url(#{1 + 2});\n}\n",
|
||||||
@ -106,7 +126,11 @@ test!(
|
|||||||
"a {\n color: url(#{http}://foo);\n}\n",
|
"a {\n color: url(#{http}://foo);\n}\n",
|
||||||
"a {\n color: url(http://foo);\n}\n"
|
"a {\n color: url(http://foo);\n}\n"
|
||||||
);
|
);
|
||||||
test!(url_dot_dot, "a {\n color: url(../foo/bar/..baz/);\n}\n");
|
test!(
|
||||||
|
url_dot_dot,
|
||||||
|
"a {\n color: url(../foo/bar/..baz/);\n}\n",
|
||||||
|
"a {\n color: url(../foo/bar/..baz/);\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
silent_comment_in_interpolation,
|
silent_comment_in_interpolation,
|
||||||
"$roboto-font-path: \"../fonts/roboto\";\n\na {\n color: url(#{//}\n $roboto-font-path});\n}\n",
|
"$roboto-font-path: \"../fonts/roboto\";\n\na {\n color: url(#{//}\n $roboto-font-path});\n}\n",
|
||||||
|
118
tests/values.rs
118
tests/values.rs
@ -6,35 +6,108 @@ test!(
|
|||||||
"a {\n color: 'foo';\n}\n",
|
"a {\n color: 'foo';\n}\n",
|
||||||
"a {\n color: \"foo\";\n}\n"
|
"a {\n color: \"foo\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(double_quote, "a {\n color: \"foo\";\n}\n");
|
test!(
|
||||||
test!(comma_list_ident, "a {\n color: foo, bar, baz;\n}\n");
|
double_quote,
|
||||||
test!(space_list_ident, "a {\n color: foo bar baz;\n}\n");
|
"a {\n color: \"foo\";\n}\n",
|
||||||
test!(comma_list_number, "a {\n color: 1, 2, 3;\n}\n");
|
"a {\n color: \"foo\";\n}\n"
|
||||||
test!(space_list_number, "a {\n color: 1 2 3;\n}\n");
|
);
|
||||||
test!(comma_space_list_number, "a {\n color: 1 1, 2 2, 3 3;\n}\n");
|
test!(
|
||||||
test!(preserves_keyword_true, "a {\n color: true;\n}\n");
|
comma_list_ident,
|
||||||
test!(preserves_keyword_false, "a {\n color: false;\n}\n");
|
"a {\n color: foo, bar, baz;\n}\n",
|
||||||
|
"a {\n color: foo, bar, baz;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
space_list_ident,
|
||||||
|
"a {\n color: foo bar baz;\n}\n",
|
||||||
|
"a {\n color: foo bar baz;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
comma_list_number,
|
||||||
|
"a {\n color: 1, 2, 3;\n}\n",
|
||||||
|
"a {\n color: 1, 2, 3;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
space_list_number,
|
||||||
|
"a {\n color: 1 2 3;\n}\n",
|
||||||
|
"a {\n color: 1 2 3;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
comma_space_list_number,
|
||||||
|
"a {\n color: 1 1, 2 2, 3 3;\n}\n",
|
||||||
|
"a {\n color: 1 1, 2 2, 3 3;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_true,
|
||||||
|
"a {\n color: true;\n}\n",
|
||||||
|
"a {\n color: true;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_false,
|
||||||
|
"a {\n color: false;\n}\n",
|
||||||
|
"a {\n color: false;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
does_not_preserve_keyword_null,
|
does_not_preserve_keyword_null,
|
||||||
"a {\n color: null;\n}\n",
|
"a {\n color: null;\n}\n",
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
test!(preserves_keyword_auto, "a {\n color: auto;\n}\n");
|
test!(
|
||||||
test!(preserves_keyword_initial, "a {\n color: initial;\n}\n");
|
preserves_keyword_auto,
|
||||||
test!(preserves_keyword_infinity, "a {\n color: infinity;\n}\n");
|
"a {\n color: auto;\n}\n",
|
||||||
|
"a {\n color: auto;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_initial,
|
||||||
|
"a {\n color: initial;\n}\n",
|
||||||
|
"a {\n color: initial;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_infinity,
|
||||||
|
"a {\n color: infinity;\n}\n",
|
||||||
|
"a {\n color: infinity;\n}\n"
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
keyword_not_expects_expression,
|
keyword_not_expects_expression,
|
||||||
"a {\n color: not;\n}\n", "Error: Expected expression."
|
"a {\n color: not;\n}\n", "Error: Expected expression."
|
||||||
);
|
);
|
||||||
test!(preserves_keyword_and, "a {\n color: and;\n}\n");
|
test!(
|
||||||
test!(preserves_keyword_or, "a {\n color: or;\n}\n");
|
preserves_keyword_and,
|
||||||
test!(preserves_keyword_unset, "a {\n color: unset;\n}\n");
|
"a {\n color: and;\n}\n",
|
||||||
test!(preserves_keyword_nan, "a {\n color: NaN;\n}\n");
|
"a {\n color: and;\n}\n"
|
||||||
test!(preserves_keyword_from, "a {\n color: FRoM;\n}\n");
|
);
|
||||||
test!(preserves_keyword_to, "a {\n color: To;\n}\n");
|
test!(
|
||||||
test!(preserves_keyword_through, "a {\n color: ThRouGh;\n}\n");
|
preserves_keyword_or,
|
||||||
|
"a {\n color: or;\n}\n",
|
||||||
|
"a {\n color: or;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_unset,
|
||||||
|
"a {\n color: unset;\n}\n",
|
||||||
|
"a {\n color: unset;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_nan,
|
||||||
|
"a {\n color: NaN;\n}\n",
|
||||||
|
"a {\n color: NaN;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_from,
|
||||||
|
"a {\n color: FRoM;\n}\n",
|
||||||
|
"a {\n color: FRoM;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_to,
|
||||||
|
"a {\n color: To;\n}\n",
|
||||||
|
"a {\n color: To;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
preserves_keyword_through,
|
||||||
|
"a {\n color: ThRouGh;\n}\n",
|
||||||
|
"a {\n color: ThRouGh;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
preserves_quotes,
|
preserves_quotes,
|
||||||
|
"a {\n color: \"'foo' \\\"bar\\\"\";\n}\n",
|
||||||
"a {\n color: \"'foo' \\\"bar\\\"\";\n}\n"
|
"a {\n color: \"'foo' \\\"bar\\\"\";\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
@ -47,7 +120,7 @@ test!(
|
|||||||
"a {\n color: 1 , 2 , 3 ;\n}\n",
|
"a {\n color: 1 , 2 , 3 ;\n}\n",
|
||||||
"a {\n color: 1, 2, 3;\n}\n"
|
"a {\n color: 1, 2, 3;\n}\n"
|
||||||
);
|
);
|
||||||
test!(number, "a {\n color: 1;\n}\n");
|
test!(number, "a {\n color: 1;\n}\n", "a {\n color: 1;\n}\n");
|
||||||
test!(
|
test!(
|
||||||
removes_paren_around_single_value,
|
removes_paren_around_single_value,
|
||||||
"a {\n color: (foo);\n}\n",
|
"a {\n color: (foo);\n}\n",
|
||||||
@ -55,9 +128,14 @@ test!(
|
|||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
undefined_function_call_is_ident,
|
undefined_function_call_is_ident,
|
||||||
|
"a {\n color: foo();\n}\n",
|
||||||
"a {\n color: foo();\n}\n"
|
"a {\n color: foo();\n}\n"
|
||||||
);
|
);
|
||||||
test!(hash_identifier_is_not_color, "a {\n color: #foo;\n}\n");
|
test!(
|
||||||
|
hash_identifier_is_not_color,
|
||||||
|
"a {\n color: #foo;\n}\n",
|
||||||
|
"a {\n color: #foo;\n}\n"
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
hash_identifier_is_string,
|
hash_identifier_is_string,
|
||||||
"a {\n color: type-of(#foo);\n}\n",
|
"a {\n color: type-of(#foo);\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user