From 360591d6e18d8676a2f86185ed42f46852387f85 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 21:40:12 +0200 Subject: plan 9: content excludes fail closed; krino.conf excludes checked without directories --- internal/cond/eval_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'internal/cond/eval_test.go') 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) + } +} -- cgit v1.3