mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 05:42:09 +08:00
add unit test
This commit is contained in:
parent
7d41987313
commit
3b8c932981
20
tree_test.go
20
tree_test.go
@ -684,6 +684,26 @@ func TestTreeRootTrailingSlashRedirect(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRedirectTrailingSlash(t *testing.T) {
|
||||||
|
var data = []struct {
|
||||||
|
path string
|
||||||
|
}{
|
||||||
|
{"/hello/:name"},
|
||||||
|
{"/hello/:name/123"},
|
||||||
|
{"/hello/:name/234"},
|
||||||
|
}
|
||||||
|
|
||||||
|
node := &node{}
|
||||||
|
for _, item := range data {
|
||||||
|
node.addRoute(item.path, fakeHandler("test"))
|
||||||
|
}
|
||||||
|
|
||||||
|
value := node.getValue("/hello/abx/", nil, getSkippedNodes(), false)
|
||||||
|
if value.tsr != true {
|
||||||
|
t.Fatalf("want true, is false")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestTreeFindCaseInsensitivePath(t *testing.T) {
|
func TestTreeFindCaseInsensitivePath(t *testing.T) {
|
||||||
tree := &node{}
|
tree := &node{}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user