Router/tests/router_test.go
2024-09-06 08:16:32 -05:00

24 lines
447 B
Go

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")
}
}