Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
vxx
/
vlib
/
v
/
tests
/
structs
/
struct_field_fn_call_test.v
18
lines
·
15
sloc
·
220 bytes
·
ec371820ad2f7b564fc9de7bffea717b96b78412
Raw
1
struct
Foo {
2
f
fn
(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