MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestValue_GetArray

Function TestValue_GetArray

value_test.go:325–363  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

323}
324
325func TestValue_GetArray(t *testing.T) {
326 type myArray []interface{}
327
328 cases := []struct {
329 name string
330 data interface{}
331 result chainResult
332 expectedArray []interface{}
333 }{
334 {
335 name: "array",
336 data: []interface{}{"foo", 123.0},
337 result: success,
338 expectedArray: []interface{}{"foo", 123.0},
339 },
340 {
341 name: "myArray",
342 data: myArray{"foo", 123.0},
343 result: success,
344 expectedArray: []interface{}(myArray{"foo", 123.0}),
345 },
346 }
347
348 for _, tc := range cases {
349 t.Run(tc.name, func(t *testing.T) {
350 reporter := newMockReporter(t)
351
352 value := NewValue(reporter, tc.data)
353 inner := value.Array()
354
355 value.chain.assert(t, tc.result)
356 inner.chain.assert(t, tc.result)
357
358 if tc.result {
359 assert.Equal(t, tc.expectedArray, inner.Raw())
360 }
361 })
362 }
363}
364
365func TestValue_GetString(t *testing.T) {
366 type myString string

Callers

nothing calls this directly

Calls 6

ArrayMethod · 0.95
newMockReporterFunction · 0.85
NewValueFunction · 0.85
assertMethod · 0.80
EqualMethod · 0.45
RawMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…