v2 / vlib / v / tests / comptime / comptime_shared_field_test.v
18 lines · 17 sloc · 253 bytes · 1f416d9bb7259c000e946fef0e34ecd72c9474e4
Raw
1struct Test {
2 a shared int
3 b shared f64
4 c shared string
5 d int
6 e f64
7 f string
8}
9
10fn test_shared_comptime() {
11 mut shares := []string{}
12 $for f in Test.fields {
13 $if f.typ is $shared {
14 shares << f.name
15 }
16 }
17 assert shares == ['a', 'b', 'c']
18}
19