(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestConversionJSONInt(t *testing.T) { |
| 94 | jsonString := |
| 95 | `{ |
| 96 | "a": 1, |
| 97 | "b": { |
| 98 | "data": 1 |
| 99 | }, |
| 100 | "c": [1], |
| 101 | "d": [[1]] |
| 102 | }` |
| 103 | m, err := objx.FromJSON(jsonString) |
| 104 | |
| 105 | assert.Nil(t, err) |
| 106 | require.NotNil(t, m) |
| 107 | assert.Equal(t, 1, m.Get("a").Int()) |
| 108 | assert.Equal(t, 1, m.Get("b.data").Int()) |
| 109 | |
| 110 | assert.True(t, m.Get("c").IsInterSlice()) |
| 111 | assert.Equal(t, float64(1), m.Get("c").InterSlice()[0]) |
| 112 | |
| 113 | assert.True(t, m.Get("d").IsInterSlice()) |
| 114 | assert.Equal(t, []interface{}{float64(1)}, m.Get("d").InterSlice()[0]) |
| 115 | } |
| 116 | |
| 117 | func TestJSONSliceInt(t *testing.T) { |
| 118 | jsonString := |
nothing calls this directly
no test coverage detected
searching dependent graphs…