package h5path import "testing" func TestSitemapAbsMatchesSiteRoutes(t *testing.T) { tests := []struct { name string path string want string }{ {name: "home", path: "/", want: "https://sgdj-h5.80sygtm.com/"}, {name: "shorts", path: "/shorts", want: "https://sgdj-h5.80sygtm.com/shorts"}, {name: "drama", path: "/drama/demo", want: "https://sgdj-h5.80sygtm.com/drama/demo"}, {name: "already_slash", path: "/topics/demo/", want: "https://sgdj-h5.80sygtm.com/topics/demo"}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := SitemapAbs("https://sgdj-h5.80sygtm.com", 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") } }