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

Function TestString_Decode

string_test.go:95–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93}
94
95func TestString_Decode(t *testing.T) {
96 t.Run("target is empty interface", func(t *testing.T) {
97 reporter := newMockReporter(t)
98
99 value := NewString(reporter, "foo")
100
101 var target interface{}
102 value.Decode(&target)
103
104 value.chain.assert(t, success)
105 assert.Equal(t, "foo", target)
106 })
107
108 t.Run("target is string", func(t *testing.T) {
109 reporter := newMockReporter(t)
110
111 value := NewString(reporter, "foo")
112
113 var target string
114 value.Decode(&target)
115
116 value.chain.assert(t, success)
117 assert.Equal(t, "foo", target)
118 })
119
120 t.Run("target is unmarshable", func(t *testing.T) {
121 reporter := newMockReporter(t)
122
123 value := NewString(reporter, "foo")
124
125 value.Decode(123)
126
127 value.chain.assert(t, failure)
128 })
129
130 t.Run("target is nil", func(t *testing.T) {
131 reporter := newMockReporter(t)
132
133 value := NewString(reporter, "foo")
134
135 value.Decode(nil)
136
137 value.chain.assert(t, failure)
138 })
139}
140
141func TestString_Alias(t *testing.T) {
142 reporter := newMockReporter(t)

Callers

nothing calls this directly

Calls 5

DecodeMethod · 0.95
newMockReporterFunction · 0.85
NewStringFunction · 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…