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

Function TestBoolean_Decode

boolean_test.go:69–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

67}
68
69func TestBoolean_Decode(t *testing.T) {
70 t.Run("target is empty interface", func(t *testing.T) {
71 reporter := newMockReporter(t)
72
73 value := NewBoolean(reporter, true)
74
75 var target interface{}
76 value.Decode(&target)
77
78 value.chain.assert(t, success)
79 assert.Equal(t, true, target)
80 })
81
82 t.Run("target is bool", func(t *testing.T) {
83 reporter := newMockReporter(t)
84
85 value := NewBoolean(reporter, true)
86
87 var target bool
88 value.Decode(&target)
89
90 value.chain.assert(t, success)
91 assert.Equal(t, true, target)
92 })
93
94 t.Run("target is nil", func(t *testing.T) {
95 reporter := newMockReporter(t)
96
97 value := NewBoolean(reporter, true)
98
99 value.Decode(nil)
100
101 value.chain.assert(t, failure)
102 })
103
104 t.Run("target is unmarshable", func(t *testing.T) {
105 reporter := newMockReporter(t)
106
107 value := NewBoolean(reporter, true)
108
109 value.Decode(123)
110
111 value.chain.assert(t, failure)
112 })
113}
114
115func TestBoolean_Alias(t *testing.T) {
116 reporter := newMockReporter(t)

Callers

nothing calls this directly

Calls 5

DecodeMethod · 0.95
newMockReporterFunction · 0.85
NewBooleanFunction · 0.85
assertMethod · 0.80
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…