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

cgen: fix map cross assign (#5603)

This commit is contained in:
yuyi
2020-07-01 20:03:12 +08:00
committed by GitHub
parent 673fe98cf5
commit 92eea7f95a
2 changed files with 16 additions and 0 deletions

View File

@ -303,3 +303,10 @@ fn test_map_keys_to_array() {
assert sarr == "['a', 'c']"
}
fn test_map_cross_assign() {
mut a := {'one':1, 'two':2}
a['one'], a['two'] = a['two'], a['one']
println(a)
assert a['one'] == 2
assert a['two'] == 1
}