test dynfunc package; standardize and refactor api #14

Merged
xdrm-brackets merged 19 commits from test/dynamic into 0.3.0 2020-04-04 10:09:20 +00:00
1 changed files with 14 additions and 0 deletions
Showing only changes of commit b48c1d07bf - Show all commits

View File

@ -117,6 +117,12 @@ func TestOutputCheck(t *testing.T) {
Fn: func() {}, Fn: func() {},
Err: ErrMissingHandlerOutput, Err: ErrMissingHandlerOutput,
}, },
// no input -> with last type not api.Error
{
Output: map[string]reflect.Type{},
Fn: func() bool { return true },
Err: ErrMissingHandlerErrorOutput,
},
// no input -> with api.Error // no input -> with api.Error
{ {
Output: map[string]reflect.Type{}, Output: map[string]reflect.Type{},
@ -185,6 +191,14 @@ func TestOutputCheck(t *testing.T) {
Fn: func() (*struct{ Test1 int }, api.Error) { return nil, api.ErrorSuccess }, Fn: func() (*struct{ Test1 int }, api.Error) { return nil, api.ErrorSuccess },
Err: nil, Err: nil,
}, },
// ignore type check on nil type
{
Output: map[string]reflect.Type{
"Test1": nil,
},
Fn: func() (*struct{ Test1 int }, api.Error) { return nil, api.ErrorSuccess },
Err: nil,
},
} }
for i, tcase := range tcases { for i, tcase := range tcases {