(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestParseMetaSets(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | input []string |
| 15 | want map[string]any |
| 16 | wantErr bool |
| 17 | }{ |
| 18 | { |
| 19 | name: "basic types", |
| 20 | input: []string{"str=hello", "num=42", "float=3.14", "bool=true", "null=null"}, |
| 21 | want: map[string]any{ |
| 22 | "str": "hello", |
| 23 | "num": int64(42), |
| 24 | "float": float64(3.14), |
| 25 | "bool": true, |
| 26 | "null": nil, |
| 27 | }, |
| 28 | }, |
| 29 | { |
| 30 | name: "json values", |
| 31 | input: []string{ |
| 32 | `arr=[1,2,3]`, |
| 33 | `obj={"foo":"bar"}`, |
| 34 | `str="quoted"`, |
| 35 | }, |
| 36 | want: map[string]any{ |
| 37 | "arr": []any{float64(1), float64(2), float64(3)}, |
| 38 | "obj": map[string]any{"foo": "bar"}, |
| 39 | "str": "quoted", |
| 40 | }, |
| 41 | }, |
| 42 | { |
| 43 | name: "nested paths", |
| 44 | input: []string{ |
| 45 | "a/b=55", |
| 46 | "a/c=2", |
| 47 | }, |
| 48 | want: map[string]any{ |
| 49 | "a": map[string]any{ |
| 50 | "b": int64(55), |
| 51 | "c": int64(2), |
| 52 | }, |
| 53 | }, |
| 54 | }, |
| 55 | { |
| 56 | name: "deep nesting", |
| 57 | input: []string{ |
| 58 | "a/b/c/d=hello", |
| 59 | }, |
| 60 | want: map[string]any{ |
| 61 | "a": map[string]any{ |
| 62 | "b": map[string]any{ |
| 63 | "c": map[string]any{ |
| 64 | "d": "hello", |
| 65 | }, |
| 66 | }, |
| 67 | }, |
| 68 | }, |
nothing calls this directly
no test coverage detected