v2 / vlib / v / tests / fns / closure_with_fixed_array_var_test.v
16 lines · 14 sloc · 251 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Crasher {
2 value int
3}
4
5fn crash(c [1]Crasher) fn () int {
6 return fn [c] () int {
7 println(c[0].value)
8 return c[0].value
9 }
10}
11
12fn test_closure_with_fixed_array_var() {
13 crash_fn := crash([Crasher{1}]!)
14 ret := crash_fn()
15 assert ret == 1
16}
17