summaryrefslogtreecommitdiff
path: root/internal/engine/facts_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 13:26:51 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 13:26:51 +0200
commit07c24054cab965800983ef40f53a05c2db131ede (patch)
tree741db561d614b35f8f94fee04fb5ce663a629a0b /internal/engine/facts_test.go
parent70dccf8d573028aaed64185acb8e134e5339afa3 (diff)
downloadkrino-0.0.3.tar.gz
krino-0.0.3.zip
krino: 0.0.3 — the plan as one block per file, wrapped, and -Pv0.0.3
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 ~.
Diffstat (limited to 'internal/engine/facts_test.go')
-rw-r--r--internal/engine/facts_test.go17
1 files changed, 17 insertions, 0 deletions
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)
+ }
+ }
+}