map-values returns a comma separated list

This commit is contained in:
ConnorSkees 2020-03-30 16:21:00 -04:00
parent 3621363e0e
commit c8a21f3500
2 changed files with 11 additions and 1 deletions

View File

@ -58,7 +58,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
};
Ok(Value::List(
map.values(),
ListSeparator::Space,
ListSeparator::Comma,
Brackets::None,
))
}),

View File

@ -54,6 +54,16 @@ test!(
"a {\n color: map-values((a: b));\n}\n",
"a {\n color: b;\n}\n"
);
test!(
map_values_empty,
"a {\n color: inspect(map-values(()));\n}\n",
"a {\n color: ();\n}\n"
);
test!(
map_values_are_comma_separated,
"a {\n color: map-values((a: b, c: d));\n}\n",
"a {\n color: b, d;\n}\n"
);
error!(
map_values_non_map,
"a {\n color: map-values(foo);\n}\n", "Error: $map: foo is not a map."