v2 / vlib / v / tests / consts / const_init_array_index_test.v
7 lines · 6 sloc · 187 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1const var = [8]int{init: index}
2const var2 = [8]u8{init: u8(index) * 2}
3
4fn test_main() {
5 assert var == [int(0), 1, 2, 3, 4, 5, 6, 7]!
6 assert var2 == [u8(0), 2, 4, 6, 8, 10, 12, 14]!
7}
8