(t *testing.T)
| 317 | } |
| 318 | |
| 319 | func TestParseRegistryWarningHeader(t *testing.T) { |
| 320 | for _, c := range []struct{ header, expected string }{ |
| 321 | {"completely invalid", ""}, |
| 322 | {`299 - "trivial"`, "trivial"}, |
| 323 | {`100 - "not-299"`, ""}, |
| 324 | {`299 localhost "warn-agent set"`, ""}, |
| 325 | {`299 - "no-terminating-quote`, ""}, |
| 326 | {"299 - \"\x01 control\"", ""}, |
| 327 | {"299 - \"\\\x01 escaped control\"", ""}, |
| 328 | {"299 - \"e\\scaped\"", "escaped"}, |
| 329 | {"299 - \"non-UTF8 \xA1\xA2\"", "non-UTF8 \xA1\xA2"}, |
| 330 | {"299 - \"non-UTF8 escaped \\\xA1\\\xA2\"", "non-UTF8 escaped \xA1\xA2"}, |
| 331 | {"299 - \"UTF8 žluťoučký\"", "UTF8 žluťoučký"}, |
| 332 | {"299 - \"UTF8 \\\xC5\\\xBEluťoučký\"", "UTF8 žluťoučký"}, |
| 333 | {`299 - "unterminated`, ""}, |
| 334 | {`299 - "warning" "some-date"`, ""}, |
| 335 | } { |
| 336 | res := parseRegistryWarningHeader(c.header) |
| 337 | assert.Equal(t, c.expected, res, c.header) |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | func TestGetBlobSize(t *testing.T) { |
| 342 | for _, c := range []struct { |
nothing calls this directly
no test coverage detected
searching dependent graphs…