From c7fdf8eef384e7de0388ab15eec50d7f3f9d5d8e Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Thu, 2 Apr 2020 15:28:35 -0400 Subject: [PATCH] maps in set-nth() --- src/builtin/list.rs | 1 + tests/list.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/builtin/list.rs b/src/builtin/list.rs index 5e52a45..4ecdcbb 100644 --- a/src/builtin/list.rs +++ b/src/builtin/list.rs @@ -78,6 +78,7 @@ pub(crate) fn register(f: &mut HashMap) { max_args!(args, 3); let (mut list, sep) = match arg!(args, 0, "list") { Value::List(v, sep, ..) => (v, sep), + Value::Map(m) => (m.entries(), ListSeparator::Comma), v => (vec![v], ListSeparator::Space), }; let n = match arg!(args, 1, "n") { diff --git a/tests/list.rs b/tests/list.rs index a5ae21f..9202424 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -83,6 +83,11 @@ test!( "a {\n color: set-nth((a, b, c), 1, e);\n}\n", "a {\n color: e, b, c;\n}\n" ); +test!( + set_nth_map, + "a {\n color: set-nth((c: d, e: f, g: h), 2, i);\n}\n", + "a {\n color: c d, i, g h;\n}\n" +); test!( append_space_separated, "a {\n color: append(a b, c);\n}\n",