x/build/blob: cover Complete
This commit is contained in:
parent
e28cfdf813
commit
31e9b3dd15
@ -69,6 +69,34 @@ func TestParseRef(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRefComplete(t *testing.T) {
|
||||||
|
cases := []struct {
|
||||||
|
in string
|
||||||
|
want bool
|
||||||
|
}{
|
||||||
|
{"", false},
|
||||||
|
{"example.com/mistral:7b+x", false},
|
||||||
|
{"example.com/mistral:7b+Q4_0", false},
|
||||||
|
{"example.com/x/mistral:latest", false},
|
||||||
|
{"mistral:7b+x", false},
|
||||||
|
|
||||||
|
{"example.com/x/mistral:latest+Q4_0", true},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range cases {
|
||||||
|
t.Run(tt.in, func(t *testing.T) {
|
||||||
|
ref := ParseRef(tt.in)
|
||||||
|
t.Logf("ParseRef(%q) = %#v", tt.in, ref)
|
||||||
|
if g := ref.Complete(); g != tt.want {
|
||||||
|
t.Errorf("Complete(%q) = %v; want %v", tt.in, g, tt.want)
|
||||||
|
}
|
||||||
|
if ref.Complete() != Complete(tt.in) {
|
||||||
|
t.Errorf("ParseRef(%s).Complete() != Complete(%s)", tt.in, tt.in)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRefFull(t *testing.T) {
|
func TestRefFull(t *testing.T) {
|
||||||
const empty = "!(MISSING DOMAIN)/!(MISSING NAMESPACE)/!(MISSING NAME):!(MISSING TAG)+!(MISSING BUILD)"
|
const empty = "!(MISSING DOMAIN)/!(MISSING NAMESPACE)/!(MISSING NAME):!(MISSING TAG)+!(MISSING BUILD)"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user