| 74 | } |
| 75 | |
| 76 | func decodeListLibResult(t *testing.T, v interface{}) ListLibResult { |
| 77 | switch res := v.(type) { |
| 78 | case []interface{}: |
| 79 | require.EqualValues(t, 6, len(res)) |
| 80 | require.EqualValues(t, "library_name", res[0]) |
| 81 | require.EqualValues(t, "engine", res[2]) |
| 82 | require.EqualValues(t, "functions", res[4]) |
| 83 | return ListLibResult{ |
| 84 | Name: res[1].(string), |
| 85 | Engine: res[3].(string), |
| 86 | Functions: res[5].([]interface{}), |
| 87 | } |
| 88 | case map[interface{}]interface{}: |
| 89 | require.EqualValues(t, 3, len(res)) |
| 90 | return ListLibResult{ |
| 91 | Name: res["library_name"].(string), |
| 92 | Engine: res["engine"].(string), |
| 93 | Functions: res["functions"].([]interface{}), |
| 94 | } |
| 95 | } |
| 96 | require.Fail(t, "unexpected type") |
| 97 | return ListLibResult{} |
| 98 | } |
| 99 | |
| 100 | func TestFunctions(t *testing.T) { |
| 101 | configOptions := []util.ConfigOptions{ |