inspect comma separated list of comma separated lists
This commit is contained in:
parent
715f6fb94a
commit
9790846c99
@ -273,6 +273,22 @@ impl Value {
|
||||
ListSeparator::Comma => format!("[{},]", v[0].inspect(span)?),
|
||||
},
|
||||
},
|
||||
Self::List(vals, sep, brackets) => match brackets {
|
||||
Brackets::None => format!(
|
||||
"{}",
|
||||
vals.iter()
|
||||
.map(|x| x.inspect(span))
|
||||
.collect::<SassResult<Vec<String>>>()?
|
||||
.join(sep.as_str()),
|
||||
),
|
||||
Brackets::Bracketed => format!(
|
||||
"[{}]",
|
||||
vals.iter()
|
||||
.map(|x| x.inspect(span))
|
||||
.collect::<SassResult<Vec<String>>>()?
|
||||
.join(sep.as_str()),
|
||||
),
|
||||
},
|
||||
Value::Function(f) => format!("get-function(\"{}\")", f.name()),
|
||||
Value::Null => "null".to_string(),
|
||||
Value::Map(map) => format!(
|
||||
@ -286,6 +302,7 @@ impl Value {
|
||||
.collect::<SassResult<Vec<String>>>()?
|
||||
.join(", ")
|
||||
),
|
||||
Value::Paren(v) => format!("({})", v.inspect(span)?),
|
||||
v => v.to_css_string(span)?,
|
||||
})
|
||||
}
|
||||
|
@ -259,6 +259,16 @@ test!(
|
||||
"a {\n color: inspect(append((), 1, space));\n}\n",
|
||||
"a {\n color: 1;\n}\n"
|
||||
);
|
||||
test!(
|
||||
inspect_list_of_empty_list,
|
||||
"a {\n color: inspect(((), ()));\n}\n",
|
||||
"a {\n color: (), ();\n}\n"
|
||||
);
|
||||
test!(
|
||||
inspect_comma_separated_list_of_comma_separated_lists,
|
||||
"a {\n color: inspect([(1, 2), (3, 4)]);\n}\n",
|
||||
"a {\n color: [(1, 2), (3, 4)];\n}\n"
|
||||
);
|
||||
test!(
|
||||
variable_does_exist,
|
||||
"$a: red; a {\n color: variable-exists(a)\n}\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user