diff options
Diffstat (limited to 'internal/engine/exclude_test.go')
| -rw-r--r-- | internal/engine/exclude_test.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/internal/engine/exclude_test.go b/internal/engine/exclude_test.go index 4e9f6e7..e5231f8 100644 --- a/internal/engine/exclude_test.go +++ b/internal/engine/exclude_test.go @@ -303,10 +303,12 @@ func TestNoTextFormatIsNoMatch(t *testing.T) { } } -// TestTextTurningBinaryFailsClosed: a file with no known extension whose -// first 8 KiB read as text but which holds a NUL further on is unreadable, -// not "no text": a content exclude still sets it aside (plan 10 re-check R4). -func TestTextTurningBinaryFailsClosed(t *testing.T) { +// TestTextTurningBinaryIsNoText: a file with no known extension whose first +// 8 KiB read as text but which holds a NUL further on - a self-extracting +// installer - counts as having no text, like an image: a content exclude +// does not set it aside and there is no warning (Ćukasz, after the plan 10 +// re-check: "ignore such ones"). +func TestTextTurningBinaryIsNoText(t *testing.T) { mixed := "confidential " + strings.Repeat("x", 9000) + "\x00tail" h, _ := excludeTree(t, map[string]string{"mixed": mixed}) main := writeConfig(t, h, `(include "dl")`, map[string]string{"dl": ` @@ -323,8 +325,8 @@ func TestTextTurningBinaryFailsClosed(t *testing.T) { t.Fatal(err) } for _, fm := range r.Matched { - if fm.File.Rel == "mixed" && (!strings.HasSuffix(fm.Excluded, "(content unreadable)") || len(fm.Rules) != 0) { - t.Errorf("mixed: Excluded %q, rules %d; want set aside as unreadable", fm.Excluded, len(fm.Rules)) + if fm.File.Rel == "mixed" && (fm.Excluded != "" || len(fm.Rules) != 1 || len(fm.Warnings) != 0) { + t.Errorf("mixed: Excluded %q, rules %d, warnings %v; want the rule and no warning", fm.Excluded, len(fm.Rules), fm.Warnings) } } } |
