x/model: make DisplayComplete DisplayFullest.

This commit is contained in:
Blake Mizerany 2024-04-05 22:47:39 -07:00
parent e4d65d5aef
commit 0bea2b8916
2 changed files with 8 additions and 5 deletions

View File

@ -191,7 +191,10 @@ func (r Name) DisplayModel() string {
return r.model
}
func (r Name) DisplayComplete() string {
// DisplayFullest returns the most specific display string of the Name.
//
// It does not include the build.
func (r Name) DisplayFullest() string {
return (Name{
host: r.host,
namespace: r.namespace,
@ -219,7 +222,7 @@ func (r Name) LogValue() slog.Value {
}
// DisplayShort returns a short display string of the Name with only the
// model, tag, and build parts.
// model, tag.
//
// It does not include the build.
func (r Name) DisplayShort() string {
@ -230,7 +233,7 @@ func (r Name) DisplayShort() string {
}
// DisplayLong returns a long display string of the Name including namespace,
// model, tag, and build parts.
// model, tag.
//
// It does not include the build.
func (r Name) DisplayLong() string {

View File

@ -254,8 +254,8 @@ func TestNameDisplay(t *testing.T) {
if g := p.DisplayLong(); g != tt.wantLong {
t.Errorf("DisplayLong = %q; want %q", g, tt.wantLong)
}
if g := p.DisplayComplete(); g != tt.wantComplete {
t.Errorf("DisplayComplete = %q; want %q", g, tt.wantComplete)
if g := p.DisplayFullest(); g != tt.wantComplete {
t.Errorf("DisplayFullest = %q; want %q", g, tt.wantComplete)
}
if g := p.String(); g != tt.in {
t.Errorf("String(%q) = %q; want %q", tt.in, g, tt.in)