v2 / vlib / v / tests / structs / struct_multi_embed_method_call_test.v
33 lines · 27 sloc · 493 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1pub struct Boundary {}
2
3pub fn (b Boundary) contains(x int, y int) bool {
4 return false
5}
6
7pub struct Base {
8 Boundary
9}
10
11pub fn (mut b Base) on_event(x int, y int) {
12 if b.Boundary.contains(x, y) {
13 }
14 if b.contains(x, y) {
15 }
16}
17
18pub struct ListBox {
19 Base
20}
21
22pub fn (mut lb ListBox) on_event(x int, y int) {
23 if lb.Base.Boundary.contains(x, y) {
24 }
25 if lb.contains(x, y) {
26 }
27}
28
29fn test_struct_multi_embed_method_call() {
30 mut list_box := ListBox{}
31 list_box.on_event(11, 22)
32 assert true
33}
34