23 lines
545 B
Go
23 lines
545 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func Test_resolveName(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
annotation string
|
|
want string
|
|
}{
|
|
{"simple", "well-known.252.no/annotation", "annotation"},
|
|
{"slash", "well-known.252.no/annotation/dfs", "annotation/dfs"},
|
|
{"empty", "well-known.252.no/", ""},
|
|
{"wrong", "bad", ""},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := resolveName(tt.annotation); got != tt.want {
|
|
t.Errorf("resolveName() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|