diff --git a/tests/Router_test.go b/tests/Router_test.go new file mode 100644 index 0000000..8c5abdc --- /dev/null +++ b/tests/Router_test.go @@ -0,0 +1,23 @@ +package router_test + +import ( + "testing" + + router "git.sharkk.net/Go/Router" +) + +func TestHello(t *testing.T) { + r := router.New[string]() + r.Add("GET", "/blog", "Blog") + r.Add("GET", "/blog/post", "Blog post") + + data, params := r.Lookup("GET", "/blog") + if data != "Blog" || len(params) != 0 { + t.Error("Invalid data") + } + + data, params = r.Lookup("GET", "/blog/post") + if data != "Blog post" || len(params) != 0 { + t.Error("Invalid data") + } +}