mirror of
https://github.com/vlang/v.git
synced 2025-09-14 23:12:33 +03:00
cgen: fix multiple array.map(anon_fn) calls
This commit is contained in:
parent
a130d3cd14
commit
12faf9fcfa
2 changed files with 12 additions and 1 deletions
|
@ -596,6 +596,18 @@ fn test_anon_fn_map() {
|
|||
assert [1,2,3].map(add_num) == [2,3,4]
|
||||
}
|
||||
|
||||
fn test_mutli_anon_fn_map() {
|
||||
a := [1,2,3].map(fn (i int) int {
|
||||
return i + 1
|
||||
})
|
||||
|
||||
b := [1,2,3].map(fn (i int) int {
|
||||
return i + 2
|
||||
})
|
||||
assert a == [2,3,4]
|
||||
assert b == [3,4,5]
|
||||
}
|
||||
|
||||
fn test_anon_fn_arg_map() {
|
||||
a := [1,2,3].map(fn (i int) int {
|
||||
return i + 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue