v2 / vlib / v / tests / structs / nested_struct_embed_selector_test.v
20 lines · 16 sloc · 169 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Foo {
2mut:
3 x int
4}
5
6struct Bar {
7 Foo
8}
9
10struct Baz {
11 Bar
12}
13
14fn test_nested_struct_embed() {
15 mut baz := Baz{}
16 baz.x = 3
17
18 println(baz.x)
19 assert baz.x == 3
20}
21