v2 / vlib / v / tests / structs / struct_child_field_default_test.v
22 lines · 19 sloc · 305 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Position {
2 line_nr int = 1
3}
4
5struct Statement {
6 pos Position
7}
8
9struct Expression {
10 pos Position
11}
12
13fn test_child_struct_field_default() {
14 stmt := Statement{
15 pos: Position{}
16 }
17 expr := Expression{}
18 println(stmt)
19 println(expr)
20 assert stmt.pos.line_nr == 1
21 assert expr.pos.line_nr == 1
22}
23