Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-09-29 13:19:07 +03:00
parent 3bc046e5d4
commit 15c020fac5
3 changed files with 12 additions and 8 deletions

View File

@@ -41,11 +41,12 @@ func TestTrieMatchRegexp(t *testing.T) {
tr.Insert([]string{http.MethodPut}, "/v1/create/{category}/{id:[0-9]+}", &handler{})
_, params, ok := tr.Search(http.MethodPut, "/v1/create/test_cat/12345")
if !ok {
switch {
case !ok:
t.Fatalf("route not found")
} else if len(params) != 2 {
case len(params) != 2:
t.Fatalf("param matching error %v", params)
} else if params["category"] != "test_cat" {
case params["category"] != "test_cat":
t.Fatalf("param matching error %v", params)
}
}