v2 / vlib / v / tests / structs / nested_struct_embed_method_call_test.v
22 lines · 18 sloc · 249 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Foo1 {
2 x int
3}
4
5struct Foo2 {
6 Foo1
7}
8
9struct Foo3 {
10 Foo2
11}
12
13fn (f Foo1) bar() string {
14 println('Foo1.bar()')
15 return 'Foo1.bar()'
16}
17
18fn test_nested_struct_embed_method_call() {
19 f3 := Foo3{}
20 ret := f3.bar()
21 assert ret == 'Foo1.bar()'
22}
23