add tests for numbers plus !important
, colors, and arglists
This commit is contained in:
parent
d9d9777467
commit
0d7208ccf0
@ -232,7 +232,11 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
|||||||
}
|
}
|
||||||
Value::String(s, q) => Value::String(format!("{}{}{}", num, unit, s), q),
|
Value::String(s, q) => Value::String(format!("{}{}{}", num, unit, s), q),
|
||||||
Value::Null => Value::String(format!("{}{}", num, unit), QuoteKind::None),
|
Value::Null => Value::String(format!("{}{}", num, unit), QuoteKind::None),
|
||||||
Value::True | Value::False | Value::List(..) => Value::String(
|
Value::True
|
||||||
|
| Value::False
|
||||||
|
| Value::List(..)
|
||||||
|
| Value::Important
|
||||||
|
| Value::ArgList(..) => Value::String(
|
||||||
format!("{}{}{}", num, unit, right.to_css_string(self.span)?),
|
format!("{}{}{}", num, unit, right.to_css_string(self.span)?),
|
||||||
QuoteKind::None,
|
QuoteKind::None,
|
||||||
),
|
),
|
||||||
@ -243,7 +247,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
|||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
}
|
}
|
||||||
_ => {
|
Value::Color(..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
"Undefined operation \"{}{} + {}\".",
|
"Undefined operation \"{}{} + {}\".",
|
||||||
|
@ -212,7 +212,7 @@ test!(
|
|||||||
"a {\n color: string;\n}\n"
|
"a {\n color: string;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
num_plus_list,
|
number_plus_list,
|
||||||
"a {\n color: 1 + (2 3);\n}\n",
|
"a {\n color: 1 + (2 3);\n}\n",
|
||||||
"a {\n color: 12 3;\n}\n"
|
"a {\n color: 12 3;\n}\n"
|
||||||
);
|
);
|
||||||
@ -282,20 +282,40 @@ test!(
|
|||||||
"a {\n color: foo#fff;\n}\n"
|
"a {\n color: foo#fff;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
num_plus_true,
|
number_plus_true,
|
||||||
"a {\n color: 1 + true;\n}\n",
|
"a {\n color: 1 + true;\n}\n",
|
||||||
"a {\n color: 1true;\n}\n"
|
"a {\n color: 1true;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
num_plus_false,
|
number_plus_false,
|
||||||
"a {\n color: 1 + false;\n}\n",
|
"a {\n color: 1 + false;\n}\n",
|
||||||
"a {\n color: 1false;\n}\n"
|
"a {\n color: 1false;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
test!(
|
||||||
num_plus_unary_not,
|
number_plus_unary_not,
|
||||||
"a {\n color: 1 + not 2;\n}\n",
|
"a {\n color: 1 + not 2;\n}\n",
|
||||||
"a {\n color: 1false;\n}\n"
|
"a {\n color: 1false;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
number_plus_important,
|
||||||
|
"a {\n color: 1 + !important;\n}\n",
|
||||||
|
"a {\n color: 1!important;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
number_plus_arglist,
|
||||||
|
"@function foo($a...) {
|
||||||
|
@return 1+$a;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: foo(a, b, c);
|
||||||
|
}",
|
||||||
|
"a {\n color: 1a, b, c;\n}\n"
|
||||||
|
);
|
||||||
|
error!(
|
||||||
|
number_plus_named_color,
|
||||||
|
"a {\n color: 1 + red;\n}\n", "Error: Undefined operation \"1 + red\"."
|
||||||
|
);
|
||||||
test!(
|
test!(
|
||||||
double_plus,
|
double_plus,
|
||||||
"a {\n color: 1 ++ 2;\n}\n",
|
"a {\n color: 1 ++ 2;\n}\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user