2024-08-22 21:50:14 -05:00
|
|
|
package router_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
router "git.sharkk.net/Go/Router"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHello(t *testing.T) {
|
2024-09-05 14:09:09 -05:00
|
|
|
r := router.New()
|
2024-08-22 21:50:14 -05:00
|
|
|
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")
|
|
|
|
}
|
|
|
|
}
|