From 07c24054cab965800983ef40f53a05c2db131ede Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 14 Sep 2026 13:26:51 +0200 Subject: krino: 0.0.3 — the plan as one block per file, wrapped, and -P MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each file shows its steps, then the rule and the reason it matched, one field per line; on a terminal every line wraps to its width with continuation lines under their own column, and piped output is never wrapped. Choosing per file shows the same block. -P / --no-pager prints the plan without the pager. A duplicate's original is shown with ~. --- internal/engine/facts_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'internal/engine/facts_test.go') diff --git a/internal/engine/facts_test.go b/internal/engine/facts_test.go index c511804..7d844a0 100644 --- a/internal/engine/facts_test.go +++ b/internal/engine/facts_test.go @@ -75,3 +75,20 @@ func TestContentKeepsRawWithTwoVariants(t *testing.T) { t.Fatalf("second variant: got %q, %v, want the unfolded original (raw text must still be available)", got, err) } } + +// TestDisplayOriginalAbbreviatesHome: a duplicate's original is shown +// root-relative inside the root, and home-abbreviated outside it, the way +// every other user-visible path is; a path outside $HOME stays absolute. +func TestDisplayOriginalAbbreviatesHome(t *testing.T) { + h := sandbox(t) + root := filepath.Join(h, "downloads") + for _, tt := range []struct{ orig, want string }{ + {filepath.Join(root, "x", "a.pdf"), "x/a.pdf"}, + {filepath.Join(h, "docs", "work", "a.pdf"), "~/docs/work/a.pdf"}, + {"/srv/share/a.pdf", "/srv/share/a.pdf"}, + } { + if got := displayOriginal(tt.orig, root); got != tt.want { + t.Errorf("displayOriginal(%q) = %q, want %q", tt.orig, got, tt.want) + } + } +} -- cgit v1.3