From f2bb6097dca91464e5e1266ffeee6e9921b2f7a8 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Fri, 3 Apr 2020 13:43:34 -0400 Subject: [PATCH] index() with maps --- src/builtin/list.rs | 1 + tests/list.rs | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/builtin/list.rs b/src/builtin/list.rs index 192dc59..6d3f004 100644 --- a/src/builtin/list.rs +++ b/src/builtin/list.rs @@ -221,6 +221,7 @@ pub(crate) fn register(f: &mut HashMap) { max_args!(args, 2); let list = match arg!(args, 0, "list") { Value::List(v, ..) => v, + Value::Map(m) => m.entries(), v => vec![v], }; let value = arg!(args, 1, "value"); diff --git a/tests/list.rs b/tests/list.rs index 4f28b28..56ca1a9 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -288,8 +288,8 @@ test!( "a {\n color: index(1px solid red, dashed);\n}\n", "" ); -// test!( -// index_found_map, -// "a {\n color: index((width: 10px, height: 20px), (height 20px));\n}\n", -// "a {\n color: 2;\n}\n" -// ); +test!( + index_found_map, + "a {\n color: index((width: 10px, height: 20px), (height 20px));\n}\n", + "a {\n color: 2;\n}\n" +);