v2 / vlib / v / tests / options / option_selector_fn_none_test.v
13 lines · 11 sloc · 170 bytes · a200c4540a5bac23f9ef5f308a2e0c079c54e12c
Raw
1struct Foo {
2mut:
3 func ?fn (voidptr) ?bool
4}
5
6fn callback(foo &Foo) ?bool {
7 return foo.func? == callback
8}
9
10fn test_main() {
11 t := Foo{}
12 assert callback(&t) == none
13}
14