diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 21:40:12 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 21:40:12 +0200 |
| commit | 360591d6e18d8676a2f86185ed42f46852387f85 (patch) | |
| tree | 31043c351f6cb2c95c6b6a26d0c69dcb47ab1e3f /internal/cond/eval_test.go | |
| parent | e0dddff176a01d410904b6750b3395de4f7e54db (diff) | |
| download | krino-360591d6e18d8676a2f86185ed42f46852387f85.tar.gz krino-360591d6e18d8676a2f86185ed42f46852387f85.zip | |
plan 9: content excludes fail closed; krino.conf excludes checked without directories
Diffstat (limited to 'internal/cond/eval_test.go')
| -rw-r--r-- | internal/cond/eval_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/cond/eval_test.go b/internal/cond/eval_test.go index 8891de7..88612ac 100644 --- a/internal/cond/eval_test.go +++ b/internal/cond/eval_test.go @@ -226,3 +226,17 @@ func TestNegatedCombinatorReason(t *testing.T) { t.Errorf("negated leaf = %+v, want its own label unchanged: %q", r, "not matched") } } + +// TestEvalReportsUnreadableContent: Result.Unreadable says a content test +// was reached and could not read the file - what lets an exclude fail +// closed (review M11) - and stays false when evaluation never reached the +// content test. +func TestEvalReportsUnreadableContent(t *testing.T) { + f := &fake{name: "a.pdf", rawErr: errors.New("larger than max-read")} + if r := eval(t, `(and (type pdf) (content "x"))`, Options{}, f); r.Match || !r.Unreadable { + t.Errorf("reached: Match %v Unreadable %v; want false, true", r.Match, r.Unreadable) + } + if r := eval(t, `(or (name "^a") (content "x"))`, Options{}, f); !r.Match || r.Unreadable { + t.Errorf("not reached: Match %v Unreadable %v; want true, false", r.Match, r.Unreadable) + } +} |
