(t *testing.T)
| 146 | } |
| 147 | |
| 148 | func TestOrComposeDecodeHookFunc_err(t *testing.T) { |
| 149 | f1 := func( |
| 150 | f reflect.Kind, |
| 151 | t reflect.Kind, |
| 152 | data interface{}) (interface{}, error) { |
| 153 | return nil, errors.New("f1 error") |
| 154 | } |
| 155 | |
| 156 | f2 := func( |
| 157 | f reflect.Kind, |
| 158 | t reflect.Kind, |
| 159 | data interface{}) (interface{}, error) { |
| 160 | return nil, errors.New("f2 error") |
| 161 | } |
| 162 | |
| 163 | f := OrComposeDecodeHookFunc(f1, f2) |
| 164 | |
| 165 | _, err := DecodeHookExec( |
| 166 | f, reflect.ValueOf(""), reflect.ValueOf([]byte(""))) |
| 167 | if err == nil { |
| 168 | t.Fatalf("bad: should return an error") |
| 169 | } |
| 170 | if err.Error() != "f1 error\nf2 error\n" { |
| 171 | t.Fatalf("bad: %s", err) |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | func TestComposeDecodeHookFunc_safe_nofuncs(t *testing.T) { |
| 176 | f := ComposeDecodeHookFunc() |
nothing calls this directly
no test coverage detected
searching dependent graphs…