improve inspect output for arglists with 1 arg
This commit is contained in:
parent
ba7a368684
commit
7971bfe98b
@ -291,6 +291,14 @@ impl Value {
|
||||
)),
|
||||
Value::Dimension(num, unit) => Cow::owned(format!("{}{}", num, unit)),
|
||||
Value::ArgList(args) if args.is_empty() => Cow::const_str("()"),
|
||||
Value::ArgList(args) if args.len() == 1 => Cow::owned(format!(
|
||||
"({},)",
|
||||
args.iter()
|
||||
.filter(|x| !x.is_null())
|
||||
.map(|a| Ok(a.node.inspect(span)?))
|
||||
.collect::<SassResult<Vec<Cow<'static, str>>>>()?
|
||||
.join(", "),
|
||||
)),
|
||||
Value::ArgList(args) => Cow::owned(
|
||||
args.iter()
|
||||
.filter(|x| !x.is_null())
|
||||
|
@ -62,3 +62,14 @@ test!(
|
||||
}",
|
||||
"a {\n color: null;\n}\n"
|
||||
);
|
||||
test!(
|
||||
inspect_arglist_with_one_arg,
|
||||
"@function foo($a...) {
|
||||
@return inspect($a);
|
||||
}
|
||||
|
||||
a {
|
||||
color: inspect(foo(1));
|
||||
}",
|
||||
"a {\n color: (1,);\n}\n"
|
||||
);
|
||||
|
@ -129,5 +129,5 @@ test!(
|
||||
a {
|
||||
color: foo((a: b));
|
||||
}",
|
||||
"a {\n color: (a: b);\n}\n"
|
||||
"a {\n color: ((a: b),);\n}\n"
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user