summaryrefslogtreecommitdiff
path: root/internal/extract/tools_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 15:16:55 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 15:16:55 +0200
commit0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe (patch)
tree358e331945b8206ed4a72703e3aedfe8ea7cdcdb /internal/extract/tools_test.go
parent1d3f2d1e4c59867024470d3444e12698b7ebb22e (diff)
downloadkrino-0.0.5.tar.gz
krino-0.0.5.zip
krino: 0.0.5 — keyword cache, t and d in reviewv0.0.5
Diffstat (limited to 'internal/extract/tools_test.go')
-rw-r--r--internal/extract/tools_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/extract/tools_test.go b/internal/extract/tools_test.go
index 4a03f1b..b481e8a 100644
--- a/internal/extract/tools_test.go
+++ b/internal/extract/tools_test.go
@@ -237,3 +237,27 @@ func TestMaxReadCapsToolOutput(t *testing.T) {
t.Fatalf("got %v, want ErrTooLarge (max-read 1024 should have capped a 200000-byte tool output)", err)
}
}
+
+// TestFingerprintFollowsTools: the fingerprint changes when a tool is
+// installed or replaced, and not otherwise.
+func TestFingerprintFollowsTools(t *testing.T) {
+ bin := t.TempDir()
+ none := newWithPath(bin).Fingerprint()
+ if none != newWithPath(bin).Fingerprint() {
+ t.Fatal("fingerprint not stable")
+ }
+ tool := filepath.Join(bin, "pdftotext")
+ if err := os.WriteFile(tool, []byte("#!/bin/sh\n"), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ installed := newWithPath(bin).Fingerprint()
+ if installed == none {
+ t.Error("installing pdftotext did not change the fingerprint")
+ }
+ if err := os.WriteFile(tool, []byte("#!/bin/sh\nexit 0\n"), 0o755); err != nil {
+ t.Fatal(err)
+ }
+ if newWithPath(bin).Fingerprint() == installed {
+ t.Error("replacing pdftotext did not change the fingerprint")
+ }
+}