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

cgen: fix array.map(anon_fn)

This commit is contained in:
yuyi
2020-06-09 16:14:10 +08:00
committed by GitHub
parent 895c7624e4
commit d472a27489
2 changed files with 16 additions and 1 deletions

View File

@ -589,6 +589,13 @@ fn test_map() {
assert strs == ['v', 'is', 'awesome']
}
fn test_anon_fn_map() {
add_num := fn (i int) int {
return i + 1
}
assert [1,2,3].map(add_num) == [2,3,4]
}
fn test_array_str() {
numbers := [1, 2, 3]
assert numbers == [1,2,3]