x/model: add CompleteNoBuild
This commit is contained in:
parent
f2c17682b0
commit
6e464ebef8
@ -286,6 +286,12 @@ func (r Name) Complete() bool {
|
||||
return !slices.Contains(r.Parts(), "")
|
||||
}
|
||||
|
||||
// CompleteNoBuild reports whether the Name is fully qualified without the
|
||||
// build part.
|
||||
func (r Name) CompleteNoBuild() bool {
|
||||
return !slices.Contains(r.Parts()[:4], "")
|
||||
}
|
||||
|
||||
// EqualFold reports whether r and o are equivalent model names, ignoring
|
||||
// case.
|
||||
func (r Name) EqualFold(o Name) bool {
|
||||
|
@ -138,11 +138,11 @@ func TestParseName(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestComplete(t *testing.T) {
|
||||
func TestCompleteWithAndWithoutBuild(t *testing.T) {
|
||||
cases := []struct {
|
||||
in string
|
||||
complete bool
|
||||
completeWithoutBuild bool
|
||||
in string
|
||||
complete bool
|
||||
completeNoBuild bool
|
||||
}{
|
||||
{"", false, false},
|
||||
{"incomplete/mistral:7b+x", false, false},
|
||||
@ -159,6 +159,9 @@ func TestComplete(t *testing.T) {
|
||||
if g := p.Complete(); g != tt.complete {
|
||||
t.Errorf("Complete(%q) = %v; want %v", tt.in, g, tt.complete)
|
||||
}
|
||||
if g := p.CompleteNoBuild(); g != tt.completeNoBuild {
|
||||
t.Errorf("CompleteNoBuild(%q) = %v; want %v", tt.in, g, tt.completeNoBuild)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user