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

cgen: fix cross assign with mutable args (fix #5609 #5610 #5611) (#5614)

This commit is contained in:
yuyi
2020-07-02 17:09:26 +08:00
committed by GitHub
parent c21527d3c6
commit 6cbc0e84f0
5 changed files with 91 additions and 37 deletions

View File

@@ -291,7 +291,6 @@ fn test_plus_assign_string() {
assert m['one'] == '1'
}
fn test_map_keys_to_array() {
m := {'a': 'b', 'c': 'd'}
mut arr := []string{}
@@ -302,11 +301,3 @@ fn test_map_keys_to_array() {
println(sarr)
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
}