MCPcopy Create free account
hub / github.com/francoispqt/gojay / TestDecodeInterfaceAsInterface

Function TestDecodeInterfaceAsInterface

decode_interface_test.go:171–304  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func TestDecodeInterfaceAsInterface(t *testing.T) {
172 testCases := []struct {
173 name string
174 json string
175 expectedResult interface{}
176 err bool
177 errType interface{}
178 skipCheckResult bool
179 }{
180 {
181 name: "basic-array",
182 json: `{
183 "testStr": "hola",
184 "testInterface": ["h","o","l","a"]
185 }`,
186 expectedResult: map[string]interface{}(
187 map[string]interface{}{
188 "testStr": "hola",
189 "testInterface": []interface{}{"h", "o", "l", "a"},
190 }),
191 err: false,
192 },
193 {
194 name: "basic-string",
195 json: `{
196 "testInterface": "漢字"
197 }`,
198 expectedResult: map[string]interface{}(
199 map[string]interface{}{
200 "testInterface": "漢字",
201 }),
202 err: false,
203 },
204 {
205 name: "basic-error",
206 json: `{
207 "testInterface": ["a""d","i","o","s"]
208 }`,
209 err: true,
210 errType: &json.SyntaxError{},
211 skipCheckResult: true,
212 },
213 {
214 name: "basic-interface",
215 json: `{
216 "testInterface": {
217 "string": "prost"
218 }
219 }`,
220 expectedResult: map[string]interface{}(
221 map[string]interface{}{
222 "testInterface": map[string]interface{}{"string": "prost"},
223 }),
224 err: false,
225 },
226 {
227 name: "complex-interface",
228 json: `{

Callers

nothing calls this directly

Calls 4

BorrowDecoderFunction · 0.85
DecodeMethod · 0.80
DecodeInterfaceMethod · 0.80
ReleaseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…