Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Jul 1, 2023
1 parent 00d25c9 commit 6462d75
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions vlib/v/tests/interface_closure_test.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
interface ITest {
mut:
caller(a Test) !
}

struct Test {
}

struct Test2 {
}

fn (t2 Test2) with_reader(func fn (a Test) !) ! {
return func(Test{})
}

fn (t Test) caller(a Test) ! {
println('ok')
}

fn get() ITest {
return Test{}
}

fn test_main() {
mut a := get()

b := Test2{}
b.with_reader(a.caller)!
assert true
}

0 comments on commit 6462d75

Please sign in to comment.