From cb046f7be7232f4ed1e30be1242c1e05de67319c Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Mon, 17 Aug 2020 03:39:33 -0400 Subject: [PATCH] `list-separator` is comma for maps and arglists --- src/builtin/functions/list.rs | 1 + tests/list.rs | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/builtin/functions/list.rs b/src/builtin/functions/list.rs index e67ab8f..5613045 100644 --- a/src/builtin/functions/list.rs +++ b/src/builtin/functions/list.rs @@ -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(), diff --git a/tests/list.rs b/tests/list.rs index 2d596a3..52952aa 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -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",