@@ -9,58 +9,10 @@ import (
99
1010const testingPostfix = "Testing"
1111
12- func TestQuickUnitCallerErr (t * testing.T ) {
13- t .Parallel ()
14-
15- config := quick.Config {
16- Values : func (args []reflect.Value , rand * rand.Rand ) {
17- rr := make (RegRoutes )
18- count := rand .Intn (550 - 1 ) + 1
19- paths := getPaths (t , count , RandomString (t , count ))
20-
21- for _ , p := range paths {
22- rr [p .Route + testingPostfix ] = getPaths
23- }
24-
25- oas := OAS {
26- Paths : getPaths (t , count , RandomString (t , count )),
27- RegisteredRoutes : rr ,
28- }
29-
30- var routes []interface {}
31- for _ , r := range rr {
32- routes = append (routes , r )
33- }
34-
35- args [0 ] = reflect .ValueOf (oas )
36- args [1 ] = reflect .ValueOf (routes )
37- },
38- }
39-
40- callerWrongParamNumber := func (oas OAS , routes []interface {}) bool {
41- oas .AttachRoutes (routes )
42-
43- for oasPathIndex := range oas .Paths {
44- _ , err := oas .Call ("getPaths" , oasPathIndex , oas )
45- if err == nil {
46- t .Errorf ("failing (OAS).Call() with err : %s" , err )
47-
48- return false
49- }
50- }
51-
52- return true
53- }
54-
55- if err := quick .Check (callerWrongParamNumber , & config ); err != nil {
56- t .Errorf ("Check failed: %#v" , err )
57- }
58- }
59-
6012func TestQuickUnitCaller (t * testing.T ) {
6113 t .Parallel ()
6214
63- successParamNumber := func (name string , oas * OAS ) {}
15+ successParamNumber := func (i int , oas * OAS ) {}
6416 config := quick.Config {
6517 Values : func (args []reflect.Value , rand * rand.Rand ) {
6618 rr := make (RegRoutes )
@@ -81,10 +33,11 @@ func TestQuickUnitCaller(t *testing.T) {
8133 }
8234
8335 callerCorrectParamNumber := func (oas OAS ) bool {
84- for _ , oasPath := range oas .Paths {
85- _ , err := oas .Call (oasPath .Route + testingPostfix , oasPath .Route , & oas )
86- if err != nil {
87- t .Errorf ("failed executing (OAS).Call() with err : %s" , err )
36+ for i , oasPath := range oas .Paths {
37+ res := oas .Call (oasPath .Route + testingPostfix , i , & oas )
38+
39+ if len (res ) > 0 {
40+ t .Error ("failed executing (OAS).Call() with" )
8841
8942 return false
9043 }
@@ -101,7 +54,7 @@ func TestQuickUnitCaller(t *testing.T) {
10154func TestUnitCaller (t * testing.T ) {
10255 t .Parallel ()
10356
104- successParamNumber := func (name string , oas * OAS ) {}
57+ successParamNumber := func (i int , oas * OAS ) {}
10558 routeName := "testRouteTesting"
10659 rr := make (RegRoutes )
10760 rr [routeName ] = successParamNumber
@@ -110,45 +63,24 @@ func TestUnitCaller(t *testing.T) {
11063 RegisteredRoutes : rr ,
11164 }
11265
113- _ , err := o .Call (routeName , routeName , & o )
114- if err != nil {
115- t .Errorf ("failed executing (OAS).Call() with err : %s" , err )
116- }
66+ _ = o .Call (routeName , 0 , & o )
11767}
11868
11969func TestUnitInitCallStack (t * testing.T ) {
12070 t .Parallel ()
12171
122- o := prepForInitCallStack (t , false )
72+ o := prepForInitCallStack (t )
12373
124- err := o .initCallStackForRoutes ()
125- if err != nil {
126- t .Errorf ("failed executing (OAS).initCallStackForRoutes() with err : %s" , err )
127- }
74+ o .initCallStackForRoutes ()
12875}
12976
130- func TestUnitInitCallStackErr (t * testing.T ) {
131- t .Parallel ()
132-
133- o := prepForInitCallStack (t , true )
134-
135- err := o .initCallStackForRoutes ()
136- if err == nil {
137- t .Errorf ("failed executing (OAS).initCallStackForRoutes() with err : %s" , err )
138- }
139- }
140-
141- func prepForInitCallStack (t * testing.T , triggerErr bool ) OAS {
77+ func prepForInitCallStack (t * testing.T ) OAS {
14278 t .Helper ()
14379
14480 routeName := "testRoute" + routePostfix
14581 rr := make (RegRoutes )
14682
147- if ! triggerErr {
148- rr [routeName ] = getSuccessParamNumber
149- } else {
150- rr [routeName ] = getFailureParamNumber
151- }
83+ rr [routeName ] = getSuccessParamNumber
15284
15385 path := Path {
15486 HandlerFuncName : "testRoute" ,
@@ -161,5 +93,6 @@ func prepForInitCallStack(t *testing.T, triggerErr bool) OAS {
16193 return o
16294}
16395
164- func getSuccessParamNumber (_ int , _ * OAS ) {}
165- func getFailureParamNumber (t * testing.T , _ int , _ * OAS ) { t .Helper () }
96+ func getSuccessParamNumber (_ int , _ * OAS ) {}
97+
98+ // func getFailureParamNumber(t *testing.T, _ int, _ *OAS) { t.Helper() }
0 commit comments