package main import "testing" func TestIsAPIPath(t *testing.T) { cases := []struct { path string want bool }{ {"/api", true}, {"/api/", true}, {"/api/domains", true}, {"/", false}, {"/domains/xyz", false}, {"/apix", false}, } for _, c := range cases { if got := isAPIPath(c.path); got != c.want { t.Errorf("isAPIPath(%q) = %v, want %v", c.path, got, c.want) } } }