v2 / vlib / v / tests / fns / lambda_as_struct_field_value_test.v
10 lines · 9 sloc · 146 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Foo {
2 sum fn (int, int) int
3}
4
5fn test_lambda_as_struct_field_value() {
6 foo := Foo{
7 sum: |x, y| x + y
8 }
9 assert foo.sum(6, 6) == 12
10}
11