MCPcopy
hub / github.com/mitchellh/mapstructure / TestComposeDecodeHookFunc_safe_nofuncs

Function TestComposeDecodeHookFunc_safe_nofuncs

decode_hooks_test.go:175–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestComposeDecodeHookFunc_safe_nofuncs(t *testing.T) {
176 f := ComposeDecodeHookFunc()
177 type myStruct2 struct {
178 MyInt int
179 }
180
181 type myStruct1 struct {
182 Blah map[string]myStruct2
183 }
184
185 src := &myStruct1{Blah: map[string]myStruct2{
186 "test": {
187 MyInt: 1,
188 },
189 }}
190
191 dst := &myStruct1{}
192 dConf := &DecoderConfig{
193 Result: dst,
194 ErrorUnused: true,
195 DecodeHook: f,
196 }
197 d, err := NewDecoder(dConf)
198 if err != nil {
199 t.Fatal(err)
200 }
201 err = d.Decode(src)
202 if err != nil {
203 t.Fatal(err)
204 }
205}
206
207func TestStringToSliceHookFunc(t *testing.T) {
208 f := StringToSliceHookFunc(",")

Callers

nothing calls this directly

Calls 3

DecodeMethod · 0.95
ComposeDecodeHookFuncFunction · 0.85
NewDecoderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…