@@ -190,6 +190,7 @@ func TestBadHandler(t *testing.T) {
190190 t .Errorf ("handlerBad should not be accepted" )
191191 }
192192}
193+
193194func TestBadVerbOn (t * testing.T ) {
194195 mux := New ()
195196 verb := "BLUB"
@@ -198,6 +199,7 @@ func TestBadVerbOn(t *testing.T) {
198199 t .Errorf ("%s should not be accepted" , verb )
199200 }
200201}
202+
201203func TestBadVerbServe (t * testing.T ) {
202204 var (
203205 method = "BLUB"
@@ -217,6 +219,7 @@ func TestBadVerbServe(t *testing.T) {
217219 t .Errorf ("%s %s got %d want %d" , method , path , res .Code , want )
218220 }
219221}
222+
220223func TestDuplicateFailure (t * testing.T ) {
221224 var (
222225 handler HandlerFunc
@@ -235,6 +238,7 @@ func TestDuplicateFailure(t *testing.T) {
235238 }
236239 }
237240}
241+
238242func TestDuplicateFailureRoot (t * testing.T ) {
239243 var (
240244 handler HandlerFunc
@@ -253,6 +257,7 @@ func TestDuplicateFailureRoot(t *testing.T) {
253257 }
254258 }
255259}
260+
256261func TestMiddleware (t * testing.T ) {
257262 var (
258263 middlewares int = 4
@@ -328,6 +333,7 @@ func TestMiddleware(t *testing.T) {
328333 run (verb )
329334 }
330335}
336+
331337func TestMiddlewareRejectionA (t * testing.T ) {
332338 mux := New ()
333339 one := func (http.ResponseWriter , * http.Request , * Context ) {}
@@ -337,6 +343,7 @@ func TestMiddlewareRejectionA(t *testing.T) {
337343 t .Errorf ("middleware with wrong signature was accepted" )
338344 }
339345}
346+
340347func TestMiddlewareRejectionB (t * testing.T ) {
341348 mux := New ()
342349 one := http .HandlerFunc (func (http.ResponseWriter , * http.Request ) {})
@@ -348,6 +355,7 @@ func TestMiddlewareRejectionB(t *testing.T) {
348355 t .Errorf ("middleware with wrong signature was accepted" )
349356 }
350357}
358+
351359func TestMiddlewareRejectionC (t * testing.T ) {
352360 mux := New ()
353361 one := http .HandlerFunc (func (http.ResponseWriter , * http.Request ) {})
@@ -356,6 +364,7 @@ func TestMiddlewareRejectionC(t *testing.T) {
356364 t .Errorf ("middleware with wrong signature was accepted" )
357365 }
358366}
367+
359368func TestMiddlewareRejectionD (t * testing.T ) {
360369 mux := New ()
361370 one := http .HandlerFunc (func (http.ResponseWriter , * http.Request ) {})
@@ -364,6 +373,7 @@ func TestMiddlewareRejectionD(t *testing.T) {
364373 t .Errorf ("middleware with wrong signature was accepted" )
365374 }
366375}
376+
367377func TestMiddlewareRejectionE (t * testing.T ) {
368378 mux := New ()
369379 var (
@@ -389,6 +399,7 @@ func TestMiddlewareRejectionE(t *testing.T) {
389399 t .Errorf ("nil middleware was accepted" )
390400 }
391401}
402+
392403func TestNoHandlers (t * testing.T ) {
393404 var (
394405 mux * Mux = New ()
@@ -406,6 +417,7 @@ func TestNoHandlers(t *testing.T) {
406417 }
407418 }
408419}
420+
409421func TestNotFoundCustom (t * testing.T ) {
410422 var (
411423 method string = "GET"
@@ -448,6 +460,7 @@ func TestNotFoundCustom(t *testing.T) {
448460 method , pathLost , patternLost , res .Code , wantLost )
449461 }
450462}
463+
451464func TestNotFoundNoParams (t * testing.T ) {
452465 var (
453466 path = "/foo/bar"
@@ -472,6 +485,7 @@ func TestNotFoundNoParams(t *testing.T) {
472485 verb , path , pattern , want )(t )
473486 }
474487}
488+
475489func TestNotFoundParams (t * testing.T ) {
476490 var (
477491 path = "/foo/BAR/baz"
@@ -496,6 +510,7 @@ func TestNotFoundParams(t *testing.T) {
496510 verb , path , pattern , want )(t )
497511 }
498512}
513+
499514func TestNotFoundRoot (t * testing.T ) {
500515 var (
501516 method string = "GET"
@@ -512,6 +527,7 @@ func TestNotFoundRoot(t *testing.T) {
512527 t .Errorf ("%s %s got %d want %d" , method , path , res .Code , want )
513528 }
514529}
530+
515531func TestNotFoundWildA (t * testing.T ) {
516532 var (
517533 path = "/foo"
@@ -536,6 +552,7 @@ func TestNotFoundWildA(t *testing.T) {
536552 verb , path , pattern , want )(t )
537553 }
538554}
555+
539556func TestNotFoundWildB (t * testing.T ) {
540557 var (
541558 method string = "GET"
@@ -557,6 +574,7 @@ func TestNotFoundWildB(t *testing.T) {
557574 t .Errorf ("%s %s got %d want %d" , method , path , res .Code , want )
558575 }
559576}
577+
560578func TestOKMultiRuleParams (t * testing.T ) {
561579 var (
562580 method string = "GET"
@@ -578,6 +596,7 @@ func TestOKMultiRuleParams(t *testing.T) {
578596 t .Errorf ("%s %s got %d want %d" , method , path , res .Code , want )
579597 }
580598}
599+
581600func TestOKNoParams (t * testing.T ) {
582601 var (
583602 path = "/foo/bar"
@@ -599,6 +618,7 @@ func TestOKNoParams(t *testing.T) {
599618 verb , path , pattern , want )(t )
600619 }
601620}
621+
602622func TestOKParams (t * testing.T ) {
603623 var (
604624 path = "/foo/BAR/baz/QUX"
@@ -621,6 +641,7 @@ func TestOKParams(t *testing.T) {
621641 verb , path , pattern , want )(t )
622642 }
623643}
644+
624645func TestOKParamsTrailingSlash (t * testing.T ) {
625646 var (
626647 path = "/foo/BAR/baz/QUX/"
@@ -643,6 +664,7 @@ func TestOKParamsTrailingSlash(t *testing.T) {
643664 verb , path , pattern , want )(t )
644665 }
645666}
667+
646668func TestOKRoot (t * testing.T ) {
647669 var (
648670 path = "/"
@@ -664,6 +686,7 @@ func TestOKRoot(t *testing.T) {
664686 verb , path , pattern , want )(t )
665687 }
666688}
689+
667690func TestOKWildRoot (t * testing.T ) {
668691 var (
669692 path = "/"
@@ -685,6 +708,7 @@ func TestOKWildRoot(t *testing.T) {
685708 verb , path , pattern , want )(t )
686709 }
687710}
711+
688712func TestSanitizePatternPrefixSuffix (t * testing.T ) {
689713 var (
690714 method = "GET"
@@ -707,6 +731,7 @@ func TestSanitizePatternPrefixSuffix(t *testing.T) {
707731 t .Errorf ("%s %s (%s) got %s want %s" , method , path , pattern , body , want )
708732 }
709733}
734+
710735func TestSanitizePatternDoubleSlash (t * testing.T ) {
711736 var (
712737 method = "GET"
@@ -729,6 +754,7 @@ func TestSanitizePatternDoubleSlash(t *testing.T) {
729754 t .Errorf ("%s %s (%s) got %s want %s" , method , path , pattern , body , want )
730755 }
731756}
757+
732758func TestUnreachableA (t * testing.T ) {
733759 mux := New ()
734760 one := func (http.ResponseWriter , * http.Request , * Context ) {}
@@ -739,6 +765,7 @@ func TestUnreachableA(t *testing.T) {
739765 t .Errorf ("unreachable A" )
740766 }
741767}
768+
742769func TestUnreachableB (t * testing.T ) {
743770 mux := New ()
744771 one := func (http.ResponseWriter , * http.Request , * Context ) {}
@@ -749,6 +776,7 @@ func TestUnreachableB(t *testing.T) {
749776 t .Errorf ("unreachable B" )
750777 }
751778}
779+
752780func TestWildcardCompeting (t * testing.T ) {
753781 var (
754782 method string = "GET"
@@ -797,6 +825,7 @@ func TestWildcardCompeting(t *testing.T) {
797825 method , pathThree , patternThree , body , wantThree )
798826 }
799827}
828+
800829func TestWildcardMethod (t * testing.T ) {
801830 var (
802831 mux = New ()
@@ -821,6 +850,7 @@ func TestWildcardMethod(t *testing.T) {
821850 }
822851 }
823852}
853+
824854func TestWildcardMethodWarning (t * testing.T ) {
825855 var (
826856 mux = New ()
@@ -835,6 +865,7 @@ func TestWildcardMethodWarning(t *testing.T) {
835865 t .Errorf ("* %s should have registered, but with an error" , pattern )
836866 }
837867}
868+
838869func TestWildcardNotLast (t * testing.T ) {
839870 var (
840871 mux = New ()
@@ -848,6 +879,7 @@ func TestWildcardNotLast(t *testing.T) {
848879 pattern )
849880 }
850881}
882+
851883func TestWildcardParams (t * testing.T ) {
852884 var (
853885 method = "GET"
@@ -870,6 +902,7 @@ func TestWildcardParams(t *testing.T) {
870902 t .Errorf ("%s %s (%s) got %s want %s" , method , path , pattern , body , want )
871903 }
872904}
905+
873906func TestAlways (t * testing.T ) {
874907 var (
875908 mux * Mux = New ()
@@ -934,6 +967,7 @@ func TestAlwaysBeforeNotFound(t *testing.T) {
934967 res = httptest .NewRecorder ()
935968 mux .ServeHTTP (res , req )
936969}
970+
937971func TestAlwaysRejection (t * testing.T ) {
938972 var (
939973 mux * Mux = New ()
@@ -943,15 +977,15 @@ func TestAlwaysRejection(t *testing.T) {
943977 four func (http.ResponseWriter , * http.Request , * Context )
944978 )
945979 if err := mux .Always (one ); err == nil {
946- t .Errorf ("Always requires non-nil HandlerFunc or its signature " )
980+ t .Errorf ("Always requires non-nil handler " )
947981 }
948982 if err := mux .Always (two ); err == nil {
949- t .Errorf ("Always requires non-nil HandlerFunc or its signature " )
983+ t .Errorf ("Always requires non-nil handler " )
950984 }
951985 if err := mux .Always (three ); err == nil {
952- t .Errorf ("Always requires non-nil HandlerFunc or its signature " )
986+ t .Errorf ("Always requires non-nil handler " )
953987 }
954988 if err := mux .Always (four ); err == nil {
955- t .Errorf ("Always requires non-nil HandlerFunc or its signature " )
989+ t .Errorf ("Always requires non-nil handler " )
956990 }
957991}
0 commit comments