list-separator is comma for maps and arglists

This commit is contained in:
Connor Skees 2020-08-17 03:39:33 -04:00
parent a0786619de
commit cb046f7be7
2 changed files with 22 additions and 5 deletions

View File

@ -70,6 +70,7 @@ pub(crate) fn list_separator(mut args: CallArgs, parser: &mut Parser<'_>) -> Sas
Ok(Value::String(
match args.get_err(0, "list")? {
Value::List(_, sep, ..) => sep.name(),
Value::Map(..) | Value::ArgList(..) => ListSeparator::Comma.name(),
_ => ListSeparator::Space.name(),
}
.to_owned(),

View File

@ -61,6 +61,27 @@ test!(
"a {\n color: list-separator(((a b, c d)));\n}\n",
"a {\n color: comma;\n}\n"
);
test!(
list_separator_map,
"a {\n color: list-separator((a: b, c: d));\n}\n",
"a {\n color: comma;\n}\n"
);
test!(
list_separator_arglist,
"@mixin foo($arg...) {
color: list-separator($arg);
}
a {
@include foo(1, 2, 3);
}",
"a {\n color: comma;\n}\n"
);
test!(
list_separator_empty,
"a {\n color: list-separator(());\n}\n",
"a {\n color: space;\n}\n"
);
test!(
set_nth_named_args,
"a {\n color: set-nth($list: 1 2 3, $n: 2, $value: foo);\n}\n",
@ -127,11 +148,6 @@ 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",