v2 / vlib / v / tests / structs / struct_local_test.v
19 lines · 16 sloc · 198 bytes · 7a4b3abd07fcb20ee5845e79e2ea42bf2ce4ab7f
Raw
1fn test_main() {
2 struct Foobar {
3 foo int
4 }
5
6 fb := Foobar{5}
7 assert fb.foo == 5
8 x()
9}
10
11fn x() {
12 struct Foobar {
13 baz string
14 }
15
16 fb := Foobar{'hello world!'}
17 println(fb.baz)
18 assert true
19}
20