v2 / vlib / v / tests / fns / go_call_generic_fn_test.v
14 lines · 13 sloc · 257 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn test[T](c chan int, s T) {
2 println('hi from generic fn test, T: ' + typeof(s).name)
3 println('s: ${s}')
4 assert true
5 c <- 123
6}
7
8fn test_go_generic_fn() {
9 mut c := chan int{}
10 spawn test[string](c, 'abcd')
11 x := <-c
12 assert x == 123
13 println('bye')
14}
15