better handle maps, arglists, and mul units in @debug
This commit is contained in:
parent
91ef5dcfd5
commit
dbfd90d444
@ -282,15 +282,23 @@ impl Value {
|
|||||||
Value::Map(map) => Cow::owned(format!(
|
Value::Map(map) => Cow::owned(format!(
|
||||||
"({})",
|
"({})",
|
||||||
map.iter()
|
map.iter()
|
||||||
.map(|(k, v)| Ok(format!(
|
.map(|(k, v)| Ok(format!("{}: {}", k.inspect(span)?, v.inspect(span)?)))
|
||||||
"{}: {}",
|
|
||||||
k.to_css_string(span)?,
|
|
||||||
v.to_css_string(span)?
|
|
||||||
)))
|
|
||||||
.collect::<SassResult<Vec<String>>>()?
|
.collect::<SassResult<Vec<String>>>()?
|
||||||
.join(", ")
|
.join(", ")
|
||||||
)),
|
)),
|
||||||
v => v.to_css_string(span)?,
|
Value::Dimension(num, unit) => Cow::owned(format!("{}{}", num, unit)),
|
||||||
|
Value::ArgList(args) => Cow::owned(
|
||||||
|
args.iter()
|
||||||
|
.filter(|x| !x.is_null())
|
||||||
|
.map(|a| Ok(a.node.inspect(span)?))
|
||||||
|
.collect::<SassResult<Vec<Cow<'static, str>>>>()?
|
||||||
|
.join(", "),
|
||||||
|
),
|
||||||
|
Value::Important
|
||||||
|
| Value::True
|
||||||
|
| Value::False
|
||||||
|
| Value::Color(..)
|
||||||
|
| Value::String(..) => self.to_css_string(span)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,3 +110,24 @@ test!(
|
|||||||
"a {\n color: inspect((((a))));\n}\n",
|
"a {\n color: inspect((((a))));\n}\n",
|
||||||
"a {\n color: a;\n}\n"
|
"a {\n color: a;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
inspect_mul_units,
|
||||||
|
"a {\n color: inspect(1em * 1px);\n}\n",
|
||||||
|
"a {\n color: 1em*px;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
inspect_map_with_map_key_and_value,
|
||||||
|
"a {\n color: inspect(((a: b): (c: d)));\n}\n",
|
||||||
|
"a {\n color: ((a: b): (c: d));\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
inspect_map_in_arglist,
|
||||||
|
"@function foo($a...) {
|
||||||
|
@return inspect($a);
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: foo((a: b));
|
||||||
|
}",
|
||||||
|
"a {\n color: (a: b);\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user