test: spec add checkOutput() tests for : nil type (ignore type check) ; invalid last output (not api.Error)
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Adrien Marquès 2020-03-29 19:31:08 +02:00
parent 307021bc88
commit b48c1d07bf
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
1 changed files with 14 additions and 0 deletions

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 {