From 31a19b5ecb2cf679cb32d3dec186e3c2081ac81f Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Thu, 2 Apr 2020 18:23:57 -0400 Subject: [PATCH] handle maps in join() --- src/builtin/list.rs | 2 ++ tests/list.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/builtin/list.rs b/src/builtin/list.rs index bb7bbb7..2c9a8aa 100644 --- a/src/builtin/list.rs +++ b/src/builtin/list.rs @@ -149,10 +149,12 @@ pub(crate) fn register(f: &mut HashMap) { max_args!(args, 4); let (mut list1, sep1, brackets) = match arg!(args, 0, "list1") { Value::List(v, sep, brackets) => (v, sep, brackets), + Value::Map(m) => (m.entries(), ListSeparator::Comma, Brackets::None), v => (vec![v], ListSeparator::Space, Brackets::None), }; let (list2, sep2) = match arg!(args, 1, "list2") { Value::List(v, sep, ..) => (v, sep), + Value::Map(m) => (m.entries(), ListSeparator::Comma), v => (vec![v], ListSeparator::Space), }; let sep = match arg!( diff --git a/tests/list.rs b/tests/list.rs index ed12465..c5b91a5 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -217,6 +217,11 @@ test!( "a {\n color: join((a,), (b,));\n}\n", "a {\n color: a, b;\n}\n" ); +test!( + join_two_maps, + "a {\n color: join((c: d, e: f), (g: h, i: j));\n}\n", + "a {\n color: c d, e f, g h, i j;\n}\n" +); test!(bracketed_ident, "a {\n color: [a];\n}\n"); test!(bracketed_space_list, "a {\n color: [a b];\n}\n"); test!(bracketed_comma_list, "a {\n color: [a, b];\n}\n");