From b48c1d07bfc68716762622ac011c42ae96601204 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 29 Mar 2020 19:31:08 +0200 Subject: [PATCH] test: spec add checkOutput() tests for : nil type (ignore type check) ; invalid last output (not api.Error) --- dynamic/spec_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dynamic/spec_test.go b/dynamic/spec_test.go index e0eb6a8..535d9e3 100644 --- a/dynamic/spec_test.go +++ b/dynamic/spec_test.go @@ -117,6 +117,12 @@ func TestOutputCheck(t *testing.T) { Fn: func() {}, 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 { 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 }, 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 {