aboutsummaryrefslogtreecommitdiff
path: root/internal/extract/plain_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:07:57 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 23:07:57 +0200
commitc66a842ce4679a3ffa5504dad39b1402bea75e9f (patch)
tree9e9db5e569b9f16a4ca4e66d0a5b0f456a186ece /internal/extract/plain_test.go
parentb013e5fb87580e4cab0d85a0d2c8bb402c610413 (diff)
downloadkrino-c66a842ce4679a3ffa5504dad39b1402bea75e9f.tar.gz
krino-c66a842ce4679a3ffa5504dad39b1402bea75e9f.zip
plan 10 re-check: cut run column, damaged undo run, emptied directory cleanup, text turning binary, explain flags, interrupt docsv0.0.7
Diffstat (limited to 'internal/extract/plain_test.go')
-rw-r--r--internal/extract/plain_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/extract/plain_test.go b/internal/extract/plain_test.go
index 045ea26..f49caf8 100644
--- a/internal/extract/plain_test.go
+++ b/internal/extract/plain_test.go
@@ -154,12 +154,15 @@ 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).
+// 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).
func TestSniffWholeFileMustBeValid(t *testing.T) {
e := newWithPath("")
data := append([]byte(strings.Repeat("x", 8192)), 0xFF, 0x00)
- if _, err := text(t, e, file(t, "blob.data", data), 0); !errors.Is(err, ErrUnsupported) {
- t.Errorf("got %v, want ErrUnsupported", err)
+ _, 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)
}
}