aboutsummaryrefslogtreecommitdiff
path: root/internal/engine/exclude_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-15 00:27:13 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-15 00:27:13 +0200
commitfc6eda20555ea33f1a8260610056b7079c8e8fd9 (patch)
treee99490730dc9e3f335d5cdf46db0222c12ae78c3 /internal/engine/exclude_test.go
parentf12f3f1356e4e96d419d66d13c2e67b73a50346f (diff)
downloadkrino-fc6eda20555ea33f1a8260610056b7079c8e8fd9.tar.gz
krino-fc6eda20555ea33f1a8260610056b7079c8e8fd9.zip
partial reads never cached; extractor version 3 discards 0.0.7 caches
Diffstat (limited to 'internal/engine/exclude_test.go')
-rw-r--r--internal/engine/exclude_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/engine/exclude_test.go b/internal/engine/exclude_test.go
index 8308a82..5a758bb 100644
--- a/internal/engine/exclude_test.go
+++ b/internal/engine/exclude_test.go
@@ -455,3 +455,31 @@ func TestExplainLeavesTheCacheAlone(t *testing.T) {
t.Errorf("explain removed the cache: %v", err)
}
}
+
+// TestPartlyReadableDocumentIsNotCached: a partial read's answers never
+// enter the keyword cache, so a second run with the cache still sets the
+// file aside (plan 11 review M2).
+func TestPartlyReadableDocumentIsNotCached(t *testing.T) {
+ h, dl := excludeTree(t, map[string]string{})
+ os.MkdirAll(dl, 0o755)
+ partDocx(t, filepath.Join(dl, "part.docx"), "good body text")
+ main := writeConfig(t, h, `(include "dl")`, map[string]string{"dl": `
+(path "~/dl")
+(exclude (content "confidential"))
+(rule "all" (move "Out"))
+`})
+ for run := 1; run <= 2; run++ {
+ e, errs := Load(main)
+ if len(errs) > 0 {
+ t.Fatal(errs)
+ }
+ e.CacheDir = filepath.Join(h, "cache")
+ r, err := e.Match(context.Background(), e.Dirs[0])
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(r.Matched) != 1 || !strings.HasSuffix(r.Matched[0].Excluded, "(content unreadable)") {
+ t.Fatalf("run %d: matched = %+v; want part.docx set aside", run, r.Matched)
+ }
+ }
+}