Handle empty lists ()
This commit is contained in:
parent
b0aff089aa
commit
87462490ac
@ -191,6 +191,10 @@ impl Value {
|
||||
}
|
||||
TokenKind::Symbol(Symbol::OpenParen) => {
|
||||
devour_whitespace_or_comment(toks);
|
||||
if toks.peek().unwrap().is_symbol(Symbol::CloseParen) {
|
||||
toks.next();
|
||||
return Ok(Value::List(Vec::new(), ListSeparator::Space));
|
||||
}
|
||||
let val = Self::from_tokens(toks, scope, super_selector)?;
|
||||
assert_eq!(
|
||||
toks.next().unwrap().kind,
|
||||
|
@ -105,3 +105,13 @@ test!(
|
||||
"a {\n color: append((a, b), c, space);\n}\n",
|
||||
"a {\n color: a b c;\n}\n"
|
||||
);
|
||||
test!(
|
||||
list_separator_empty,
|
||||
"a {\n color: list-separator(());\n}\n",
|
||||
"a {\n color: space;\n}\n"
|
||||
);
|
||||
test!(
|
||||
append_empty,
|
||||
"a {\n color: append((), a);\n}\n",
|
||||
"a {\n color: a;\n}\n"
|
||||
);
|
||||
|
@ -129,6 +129,11 @@ test!(
|
||||
"a {\n color: type-of(red)\n}\n",
|
||||
"a {\n color: color;\n}\n"
|
||||
);
|
||||
test!(
|
||||
type_of_empty_list,
|
||||
"a {\n color: type-of(())\n}\n",
|
||||
"a {\n color: list;\n}\n"
|
||||
);
|
||||
test!(
|
||||
type_of_spaced_list,
|
||||
"a {\n color: type-of(1 2 3)\n}\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user