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

Function TestComposeDecodeHookFunc_err

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

Source from the content-addressed store, hash-verified

37}
38
39func TestComposeDecodeHookFunc_err(t *testing.T) {
40 f1 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) {
41 return nil, errors.New("foo")
42 }
43
44 f2 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) {
45 panic("NOPE")
46 }
47
48 f := ComposeDecodeHookFunc(f1, f2)
49
50 _, err := DecodeHookExec(
51 f, reflect.ValueOf(""), reflect.ValueOf([]byte("")))
52 if err.Error() != "foo" {
53 t.Fatalf("bad: %s", err)
54 }
55}
56
57func TestComposeDecodeHookFunc_kinds(t *testing.T) {
58 var f2From reflect.Kind

Callers

nothing calls this directly

Calls 3

ComposeDecodeHookFuncFunction · 0.85
DecodeHookExecFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…