vxx2 / vlib / v / checker / tests / comptime_dump_fields_var_test.vv
21 lines · 19 sloc · 239 bytes · c3ee26f15fb66d664d9e775b705ae1309e026432
Raw
1struct Foo {
2 a string
3 b ?string
4 c int
5 d ?int
6 e struct {
7 i ?int
8 }
9}
10
11fn run[T](val T) {
12 $for field in T.fields {
13 dump(val.$(field.name))
14 }
15 println('ok')
16}
17
18fn test_main() {
19 foo := Foo{'c', 'd', 1, 0, struct {100}}
20 run(foo)
21}
22