1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: parse map{key_expr: val_expr} (#8608)

This commit is contained in:
Nick Treleaven
2021-02-06 21:13:24 +00:00
committed by GitHub
parent db0fc8fbc9
commit f5f65f929f
7 changed files with 67 additions and 14 deletions

View File

@@ -128,13 +128,17 @@ fn test_map() {
}
fn test_map_init() {
m := {
'one': 1
one := 'one'
three := 'three'
m := map{
one: 1
'two': 2
three: 1 + 2
}
assert m['one'] == 1
assert m['two'] == 2
assert m['three'] == 0
assert m['three'] == 3
assert m['unknown'] == 0
}
fn test_string_map() {