init: web_hgdjc_server
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package h5path
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSitemapAbsKeepsTrailingSlash(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
path string
|
||||
want string
|
||||
}{
|
||||
{name: "home", path: "/", want: "https://huangguo.net/"},
|
||||
{name: "list", path: "/list", want: "https://huangguo.net/list/"},
|
||||
{name: "playlet", path: "/play/demo", want: "https://huangguo.net/play/demo/"},
|
||||
{name: "already_slash", path: "/series-play/demo/", want: "https://huangguo.net/series-play/demo/"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got := SitemapAbs("https://huangguo.net", tt.path)
|
||||
if got != tt.want {
|
||||
t.Fatalf("SitemapAbs() = %q, want %q", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbsKeepsExistingBehavior(t *testing.T) {
|
||||
got := Abs("https://huangguo.net", "/list")
|
||||
if got != "https://huangguo.net/list" {
|
||||
t.Fatalf("Abs() = %q, want %q", got, "https://huangguo.net/list")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user