diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 23:24:08 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 23:24:08 +0200 |
| commit | 11a2c57c6eeaff0ef963fc6f8b74caa27b147bdb (patch) | |
| tree | 336b39597f95d6b97b460075cb50371c979e733c /internal/extract/plain_test.go | |
| parent | c66a842ce4679a3ffa5504dad39b1402bea75e9f (diff) | |
| download | krino-11a2c57c6eeaff0ef963fc6f8b74caa27b147bdb.tar.gz krino-11a2c57c6eeaff0ef963fc6f8b74caa27b147bdb.zip | |
text that turns binary further on has no content, like an image
Diffstat (limited to 'internal/extract/plain_test.go')
| -rw-r--r-- | internal/extract/plain_test.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/internal/extract/plain_test.go b/internal/extract/plain_test.go index f49caf8..5752bf8 100644 --- a/internal/extract/plain_test.go +++ b/internal/extract/plain_test.go @@ -154,15 +154,13 @@ func TestToolsListedInOrder(t *testing.T) { // but the file goes on to hold an invalid UTF-8 byte and a NUL past that // sample — sniffText must reject the whole file, not just decode what the // sample alone promised (it must not fall back to Latin-1 the way a known -// text extension would). It is not "no text in this format" either: the -// text it began with could hold a keyword, so it is ErrMixed, a read -// failure, and a content exclude fails closed on it (plan 10 re-check R4). +// text extension would). Such a file - a self-extracting installer, say - +// has no text in krino's sense (Łukasz, after the plan 10 re-check). func TestSniffWholeFileMustBeValid(t *testing.T) { e := newWithPath("") data := append([]byte(strings.Repeat("x", 8192)), 0xFF, 0x00) - _, err := text(t, e, file(t, "blob.data", data), 0) - if !errors.Is(err, ErrMixed) || errors.Is(err, ErrUnsupported) { - t.Errorf("got %v, want ErrMixed and not ErrUnsupported", err) + if _, err := text(t, e, file(t, "blob.data", data), 0); !errors.Is(err, ErrUnsupported) { + t.Errorf("got %v, want ErrUnsupported", err) } } |
