MCPcopy Create free account
hub / github.com/gavv/httpexpect / TestValue_GetBoolean

Function TestValue_GetBoolean

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

Source from the content-addressed store, hash-verified

434}
435
436func TestValue_GetBoolean(t *testing.T) {
437 type myBool bool
438
439 cases := []struct {
440 name string
441 data interface{}
442 result chainResult
443 expectedBool bool
444 }{
445 {name: "false", data: false, result: success, expectedBool: false},
446 {name: "true", data: true, result: success, expectedBool: true},
447 {name: "myTrue", data: myBool(true), result: success, expectedBool: true},
448 }
449
450 for _, tc := range cases {
451 t.Run(tc.name, func(t *testing.T) {
452 reporter := newMockReporter(t)
453
454 value := NewValue(reporter, tc.data)
455 inner := value.Boolean()
456
457 value.chain.assert(t, tc.result)
458 inner.chain.assert(t, tc.result)
459
460 if tc.result {
461 assert.Equal(t, tc.expectedBool, inner.Raw())
462 }
463 })
464 }
465}
466
467func TestValue_IsObject(t *testing.T) {
468 cases := []struct {

Callers

nothing calls this directly

Calls 7

BooleanMethod · 0.95
myBoolTypeAlias · 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…