x/mode: more tests and a quick note

This commit is contained in:
Blake Mizerany 2024-04-07 16:38:50 -07:00
parent 98dbc1202a
commit be7fe0d6d8
2 changed files with 6 additions and 0 deletions

View File

@ -477,6 +477,10 @@ func Parts(s string) iter.Seq2[NamePart, string] {
state, j := PartDigest, len(s)
for i := len(s) - 1; i >= 0; i-- {
if partLen++; partLen > MaxNamePartLen {
// catch a part that is too long early, so
// we don't keep spinning on it, waiting for
// an isInValidPart check which would scan
// over it again.
yield(PartInvalid, "")
return
}

View File

@ -60,6 +60,8 @@ var testNames = map[string]fields{
"x@sha123-1": {model: "x", digest: "sha123-1"},
"@sha456-2": {digest: "sha456-2"},
"@@sha123-1": {},
// preserves case for build
"x+b": {model: "x", build: "b"},