package io import ( "strings" "testing" ) func TestIsBlossomPath(t *testing.T) { hash := strings.Repeat("ab", 32) yes := []string{ "/upload", "/blossom/upload", "/list/" + hash, "/blossom/list/" + hash, "/" + hash, "/blossom/" + hash, "/" + hash + ".jpg", "/blossom/" + hash + ".jpg", } for _, p := range yes { if !isBlossomPath(p) { t.Errorf("%q: not a Blossom path", p) } } no := []string{ "/", "/blossom", "/blossom/notahash", "/" + strings.Repeat("ab", 31), "/" + hash + "x", } for _, p := range no { if isBlossomPath(p) { t.Errorf("%q: unexpectedly a Blossom path", p) } } }