v2 / vlib / v / tests / structs / missing_config_struct_arg_test.v
26 lines · 22 sloc · 249 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1@[params]
2struct Foo {
3 x int
4}
5
6fn foo(f Foo) int {
7 return f.x
8}
9
10@[params]
11struct Bar {
12 x int
13 y int = 1234
14}
15
16fn bar(b Bar) Bar {
17 return b
18}
19
20fn test_missing_config_struct_arg() {
21 assert foo() == 0
22 assert bar() == Bar{
23 x: 0
24 y: 1234
25 }
26}
27