| 1 | fn test_unwrap_generic_params() { |
| 2 | assert encode(true) == [] |
| 3 | assert encode([true]) == ['[]bool'] |
| 4 | assert encode(1) == [] |
| 5 | assert encode([1]) == ['[]int'] |
| 6 | assert encode('1') == [] |
| 7 | assert encode(['1']) == ['[]string'] |
| 8 | } |
| 9 | |
| 10 | fn encode[U](val U) []string { |
| 11 | mut c := []string{} |
| 12 | $if U is $array { |
| 13 | c << g_array(val) |
| 14 | } |
| 15 | return c |
| 16 | } |
| 17 | |
| 18 | fn g_array[T](t []T) string { |
| 19 | return typeof(t).name |
| 20 | } |
| 21 |