(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestComposeDecodeHookFunc(t *testing.T) { |
| 13 | f1 := func( |
| 14 | f reflect.Kind, |
| 15 | t reflect.Kind, |
| 16 | data interface{}) (interface{}, error) { |
| 17 | return data.(string) + "foo", nil |
| 18 | } |
| 19 | |
| 20 | f2 := func( |
| 21 | f reflect.Kind, |
| 22 | t reflect.Kind, |
| 23 | data interface{}) (interface{}, error) { |
| 24 | return data.(string) + "bar", nil |
| 25 | } |
| 26 | |
| 27 | f := ComposeDecodeHookFunc(f1, f2) |
| 28 | |
| 29 | result, err := DecodeHookExec( |
| 30 | f, reflect.ValueOf(""), reflect.ValueOf([]byte(""))) |
| 31 | if err != nil { |
| 32 | t.Fatalf("bad: %s", err) |
| 33 | } |
| 34 | if result.(string) != "foobar" { |
| 35 | t.Fatalf("bad: %#v", result) |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func TestComposeDecodeHookFunc_err(t *testing.T) { |
| 40 | f1 := func(reflect.Kind, reflect.Kind, interface{}) (interface{}, error) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…