33 * Copyright(c) 2019 Roshan Gade
44 * MIT Licensed
55 */
6-
76package rest
87
98import (
@@ -22,7 +21,7 @@ func TestNamespace_Set(t *testing.T) {
2221 }
2322}
2423
25- func validateRoute (fun string , method string , url string , t * testing.T ) {
24+ func validateNsRoute (fun string , method string , url string , t * testing.T ) {
2625 flag := true
2726 for _ , route := range api .routes {
2827 if route .method == method && route .pattern == url {
@@ -32,62 +31,62 @@ func validateRoute(fun string, method string, url string, t *testing.T) {
3231 }
3332
3433 if flag {
35- t .Error ("Namespace " + fun + " is not working properly" )
34+ t .Error ("Namespace: " + fun + " is not working properly" )
3635 }
3736}
3837
3938func TestNamespace_Use (t * testing.T ) {
4039 ns .Use (handle )
4140
42- validateRoute ("Use" , "" , "/test/*" , t )
41+ validateNsRoute ("Use" , "" , "/test/*" , t )
4342}
4443
4544func TestNamespace_All (t * testing.T ) {
4645 ns .All ("/:uid" , handle )
4746
48- validateRoute ("All" , "" , "/test/:uid" , t )
47+ validateNsRoute ("All" , "" , "/test/:uid" , t )
4948}
5049
5150func TestNamespace_Get (t * testing.T ) {
5251 ns .Get ("/:uid" , handle )
5352
54- validateRoute ("Get" , "GET" , "/test/:uid" , t )
53+ validateNsRoute ("Get" , "GET" , "/test/:uid" , t )
5554}
5655
5756func TestNamespace_Post (t * testing.T ) {
5857 ns .Post ("/:uid" , handle )
5958
60- validateRoute ("Post" , "POST" , "/test/:uid" , t )
59+ validateNsRoute ("Post" , "POST" , "/test/:uid" , t )
6160}
6261
6362func TestNamespace_Put (t * testing.T ) {
6463 ns .Put ("/:uid" , handle )
6564
66- validateRoute ("Put" , "PUT" , "/test/:uid" , t )
65+ validateNsRoute ("Put" , "PUT" , "/test/:uid" , t )
6766}
6867
6968func TestNamespace_Delete (t * testing.T ) {
7069 ns .Delete ("/:uid" , handle )
7170
72- validateRoute ("Delete" , "DELETE" , "/test/:uid" , t )
71+ validateNsRoute ("Delete" , "DELETE" , "/test/:uid" , t )
7372}
7473
7574func TestNamespace_Options (t * testing.T ) {
7675 ns .Options ("/:uid" , handle )
7776
78- validateRoute ("Options" , "OPTIONS" , "/test/:uid" , t )
77+ validateNsRoute ("Options" , "OPTIONS" , "/test/:uid" , t )
7978}
8079
8180func TestNamespace_Head (t * testing.T ) {
8281 ns .Head ("/:uid" , handle )
8382
84- validateRoute ("Head" , "HEAD" , "/test/:uid" , t )
83+ validateNsRoute ("Head" , "HEAD" , "/test/:uid" , t )
8584}
8685
8786func TestNamespace_Patch (t * testing.T ) {
8887 ns .Patch ("/:uid" , handle )
8988
90- validateRoute ("Patch" , "PATCH" , "/test/:uid" , t )
89+ validateNsRoute ("Patch" , "PATCH" , "/test/:uid" , t )
9190}
9291
9392func TestNamespace_Exception (t * testing.T ) {
@@ -102,6 +101,6 @@ func TestNamespace_Exception(t *testing.T) {
102101 }
103102
104103 if flag {
105- t .Error ("Namespace Exception is not working properly" )
104+ t .Error ("Namespace: Exception is not working properly" )
106105 }
107106}
0 commit comments