v2 / vlib / v / tests / builtin_arrays / fixed_array_explicit_decompose_test.v
12 lines · 11 sloc · 183 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn sum(a ...int) int {
2 mut total := 0
3 for x in a {
4 total += x
5 }
6 return total
7}
8
9fn test_fixed_array_explicit_decompose() {
10 arr := [1, 2, 3, 4]!
11 assert sum(...arr[..]) == 10
12}
13