add map fn tests for empty lists
This commit is contained in:
parent
d88ac86bd1
commit
dae7a5028d
23
tests/map.rs
23
tests/map.rs
@ -12,10 +12,19 @@ test!(
|
||||
"a {\n color: map-get((a: b), foo);\n}\n",
|
||||
""
|
||||
);
|
||||
test!(
|
||||
map_get_empty_list,
|
||||
"a {\n color: map-get((), foo);\n}\n",
|
||||
""
|
||||
);
|
||||
error!(
|
||||
map_get_non_map,
|
||||
"a {\n color: map-get(foo, foo);\n}\n", "Error: $map: foo is not a map."
|
||||
);
|
||||
error!(
|
||||
map_get_one_arg,
|
||||
"a {\n color: map-get(1);\n}\n", "Error: Missing argument $key."
|
||||
);
|
||||
test!(
|
||||
map_has_key_true,
|
||||
"a {\n color: map-has-key((a: b), a);\n}\n",
|
||||
@ -26,6 +35,11 @@ test!(
|
||||
"a {\n color: map-has-key((a: b), foo);\n}\n",
|
||||
"a {\n color: false;\n}\n"
|
||||
);
|
||||
test!(
|
||||
map_has_key_empty_list,
|
||||
"a {\n color: map-has-key((), foo);\n}\n",
|
||||
"a {\n color: false;\n}\n"
|
||||
);
|
||||
error!(
|
||||
map_has_key_non_map,
|
||||
"a {\n color: map-has-key(foo, foo);\n}\n", "Error: $map: foo is not a map."
|
||||
@ -111,10 +125,6 @@ test!(
|
||||
"a {\n color: length((a: b, c: d, e: f));\n}\n",
|
||||
"a {\n color: 3;\n}\n"
|
||||
);
|
||||
error!(
|
||||
map_get_one_arg,
|
||||
"a {\n color: map-get(1);\n}\n", "Error: Missing argument $key."
|
||||
);
|
||||
error!(
|
||||
map_has_key_one_arg,
|
||||
"a {\n color: map-has-key(1);\n}\n", "Error: Missing argument $key."
|
||||
@ -129,6 +139,11 @@ test!(
|
||||
"a {\n color: inspect(map-remove((\"foo\": 1, \"bar\": 2, \"baz\": 3), \"bar\", \"baz\"));\n}\n",
|
||||
"a {\n color: (\"foo\": 1);\n}\n"
|
||||
);
|
||||
test!(
|
||||
map_remove_empty_list,
|
||||
"a {\n color: inspect(map-remove((), foo));\n}\n",
|
||||
"a {\n color: ();\n}\n"
|
||||
);
|
||||
error!(
|
||||
duplicate_key_in_declaration,
|
||||
"a {\n $a: (foo: a, foo: b);\n}\n", "Error: Duplicate key."
|
||||
|
Loading…
x
Reference in New Issue
Block a user