From 0b5d0eb92c5be2f0ddb2fa73990f31e5654e57fe Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 15:16:55 +0200 Subject: krino: 0.0.5 — keyword cache, t and d in review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/extract/tools_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'internal/extract/tools_test.go') 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") + } +} -- cgit v1.3