diff --git a/vlib/v/tests/map_and_array_with_fns_test.v b/vlib/v/tests/map_and_array_with_fns_test.v index c949b25f39..815d229fdc 100644 --- a/vlib/v/tests/map_and_array_with_fns_test.v +++ b/vlib/v/tests/map_and_array_with_fns_test.v @@ -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 +}