handle maps in join()
This commit is contained in:
parent
a9230b7877
commit
31a19b5ecb
@ -149,10 +149,12 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
||||
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!(
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user