Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
structs
/
struct_field_fn_call_test.v
18
lines
·
15
sloc
·
225 bytes
·
e2e5cf8db56f3562c7baa735061690be936bdf3e
Raw
1
struct
Foo {
2
f
fn
(main.Foo) int = dummy
3
}
4
5
fn
dummy(s Foo) int {
6
return
22
7
}
8
9
fn
(
mut
s Foo) fun() int {
10
return
s.f(s)
11
}
12
13
fn
test_struct_field_fn_call() {
14
mut
s := Foo{}
15
ret := s.fun()
16
println(ret)
17
assert ret == 22
18
}
19