v2 / vlib / v / tests / generics / multiple_generic_resolve_test.v
25 lines · 20 sloc · 378 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct App {
2}
3
4struct Config[T] {
5 val T
6}
7
8fn pre_start[T, R](app T, config R) string {
9 return start(app, config.val)
10}
11
12fn start[T, R](app T, otherthing R) string {
13 println(otherthing)
14 return '${otherthing}'
15}
16
17fn test_multiple_generic_resolve() {
18 app := App{}
19 testval := 'hello'
20 config := Config[string]{
21 val: testval
22 }
23
24 assert pre_start(app, config) == 'hello'
25}
26