v2 / vlib / v / checker / tests / struct_fixed_array_init_test.vv
17 lines · 13 sloc · 222 bytes · 9921598c91d2a2483efb1607c8fcbf0ea2feaaa9
Raw
1module main
2
3type Data = [3]int | int
4
5struct Sample {
6 data Data
7}
8
9fn test_main() {
10 test := Sample{
11 data: [5, 10, 15]!
12 // data: 5 /* works fine */
13 }
14
15 println(test)
16 assert test.data.str() == 'Data([5, 10, 15])'
17}
18