v2 / vlib / v / tests / comptime / comptime_call_slice_arg_test.v
17 lines · 14 sloc · 271 bytes · dd1d0781d4b335867f4dfcb0912e0e6b451e7464
Raw
1struct Dummy {}
2
3fn (d Dummy) sample(x int) int {
4 return x + 1
5}
6
7fn test_main() {
8 args := ['0', '5']
9 $for method in Dummy.methods {
10 if args.len > 1 {
11 assert Dummy{}.$method(...args[1 ..]) == 6
12
13 tmp := args[1..]
14 assert Dummy{}.$method(...tmp) == 6
15 }
16 }
17}
18