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

Function TestValue_GetString

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

Source from the content-addressed store, hash-verified

363}
364
365func TestValue_GetString(t *testing.T) {
366 type myString string
367
368 cases := []struct {
369 name string
370 data interface{}
371 result chainResult
372 expectedString string
373 }{
374 {
375 name: "string",
376 data: "foo",
377 result: success,
378 expectedString: "foo",
379 },
380 {
381 name: "myString",
382 data: myString("foo"),
383 result: success,
384 expectedString: "foo",
385 },
386 }
387
388 for _, tc := range cases {
389 t.Run(tc.name, func(t *testing.T) {
390 reporter := newMockReporter(t)
391
392 value := NewValue(reporter, tc.data)
393 inner := value.String()
394
395 value.chain.assert(t, tc.result)
396 inner.chain.assert(t, tc.result)
397
398 if tc.result {
399 assert.Equal(t, tc.expectedString, inner.Raw())
400 }
401 })
402 }
403}
404
405func TestValue_GetNumber(t *testing.T) {
406 type myInt int

Callers

nothing calls this directly

Calls 7

StringMethod · 0.95
myStringTypeAlias · 0.85
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…