v2 / vlib / v / tests / options / option_fn_alias_test.v
12 lines · 10 sloc · 229 bytes · 986ed33debd2de711edda36320d34ec343f36375
Raw
1type Foo = fn (bar string)
2
3fn test_main() {
4 mut func := ?Foo(none)
5 res := dump(func)
6 assert res == none
7
8 mut func2 := ?Foo(fn (bar string) {})
9 res2 := dump(func2)
10 assert res2 != none
11 assert res2?.str() == 'fn (string)'
12}
13