Initial commit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-11-07 10:47:18 +08:00
co-authored by Claude Opus 4.7
commit 79ac89b458
708 changed files with 151634 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package h5path
import "testing"
func TestSitemapAbsMatchesCanonical(t *testing.T) {
tests := []struct {
name string
path string
want string
}{
{name: "home", path: "/", want: "https://huangguo.net"},
{name: "shorts", path: "/shorts", want: "https://huangguo.net/shorts"},
{name: "playlet", path: "/short-drama/demo", want: "https://huangguo.net/short-drama/demo"},
{name: "already_slash", path: "/topics/wuxia/", want: "https://huangguo.net/topics/wuxia"},
}
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")
}
}