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

Function TestComposeDecodeHookFunc_kinds

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

Source from the content-addressed store, hash-verified

55}
56
57func TestComposeDecodeHookFunc_kinds(t *testing.T) {
58 var f2From reflect.Kind
59
60 f1 := func(
61 f reflect.Kind,
62 t reflect.Kind,
63 data interface{}) (interface{}, error) {
64 return int(42), nil
65 }
66
67 f2 := func(
68 f reflect.Kind,
69 t reflect.Kind,
70 data interface{}) (interface{}, error) {
71 f2From = f
72 return data, nil
73 }
74
75 f := ComposeDecodeHookFunc(f1, f2)
76
77 _, err := DecodeHookExec(
78 f, reflect.ValueOf(""), reflect.ValueOf([]byte("")))
79 if err != nil {
80 t.Fatalf("bad: %s", err)
81 }
82 if f2From != reflect.Int {
83 t.Fatalf("bad: %#v", f2From)
84 }
85}
86
87func TestOrComposeDecodeHookFunc(t *testing.T) {
88 f1 := func(

Callers

nothing calls this directly

Calls 2

ComposeDecodeHookFuncFunction · 0.85
DecodeHookExecFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…