tests: add regression tests for typeof map and array of fns (#8458)
parent
09c65163b4
commit
ae60ea4ed5
|
@ -57,3 +57,17 @@ fn test_map_with_fns() {
|
|||
assert func('ccccccc', '') == 27
|
||||
}
|
||||
}
|
||||
|
||||
fn foo3(a string) int {
|
||||
return 10 + a.len
|
||||
}
|
||||
|
||||
fn test_map_and_array_with_fns_typeof_and_direct_call() {
|
||||
a := [foo3]
|
||||
assert typeof(a).name == '[]fn (string) int'
|
||||
assert a[0]('hello') == 15
|
||||
b := {'one': foo3}
|
||||
assert typeof(b).name == 'map[string]fn (string) int'
|
||||
// TODO: enable this
|
||||
// assert b['one']('hi') == 12
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue