diff --git a/x/build/blob/ref.go b/x/build/blob/ref.go index 63129d594..74fd1da7a 100644 --- a/x/build/blob/ref.go +++ b/x/build/blob/ref.go @@ -299,17 +299,6 @@ func Parts(s string) iter.Seq2[PartKind, string] { } } -// Complete is the same as ParseRef(s).Complete(). -// -// Future versions may be faster than calling ParseRef(s).Complete(), so if -// need to know if a ref is complete and don't need the ref, use this -// function. -func Complete(s string) bool { - // TODO(bmizerany): fast-path this with a quick scan withput - // allocating strings - return ParseRef(s).Complete() -} - // Valid returns true if the ref has a valid name. To know if a ref is // "complete", use Complete. func (r Ref) Valid() bool { diff --git a/x/build/blob/ref_test.go b/x/build/blob/ref_test.go index 33b741b86..dcf938e5f 100644 --- a/x/build/blob/ref_test.go +++ b/x/build/blob/ref_test.go @@ -64,6 +64,12 @@ func TestParseRef(t *testing.T) { if ParseRef(got.String()) != got { t.Errorf("String() = %s; want %s", got.String(), s) } + + if got.Valid() && got.Name() == "" { + t.Errorf("Valid() = true; Name() = %q; want non-empty name", got.Name()) + } else if !got.Valid() && got.Name() != "" { + t.Errorf("Valid() = false; Name() = %q; want empty name", got.Name()) + } }) } }