aboutsummaryrefslogtreecommitdiff
path: root/tests/test-duet-safety.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-06 11:37:39 -0500
committerCraig Jennings <c@cjennings.net>2026-06-06 11:37:39 -0500
commit0930ec3c259d93a68fc59854677cdc7fef634e71 (patch)
tree924f79ddb4447cdac01eae9dfe3e9bca51b611b3 /tests/test-duet-safety.el
parentef33eefa4cc45f2d80d7ffe27080bf766e9fa999 (diff)
downloadduet-0930ec3c259d93a68fc59854677cdc7fef634e71.tar.gz
duet-0930ec3c259d93a68fc59854677cdc7fef634e71.zip
test: cover the remaining failure, contract, and safety branches
The bug fixes raised line coverage on duet.el to 92.3%. This closes the rest. The new tests exercise the branches a review would want locked down before execution and UI build on this core: each arm of the minimal failure normalizer (missing executable, stall, signal cancellation, unknown-without-exit), a :match predicate rather than a regexp, the rsync normalizer mapping known stderr to permission/space/protocol classes, the capability-tier contract check, an explicit :async override, the case-collision path through the safety composite's injected predicates, and redaction of a pattern with no capture group. Line coverage on duet.el is now 100%. The one deliberately trivial case left is the entry command, a not-yet-implemented stub that errors. Its test asserts that and will change when the pane layout lands.
Diffstat (limited to 'tests/test-duet-safety.el')
-rw-r--r--tests/test-duet-safety.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test-duet-safety.el b/tests/test-duet-safety.el
index 450a8ea..3f07b6f 100644
--- a/tests/test-duet-safety.el
+++ b/tests/test-duet-safety.el
@@ -101,6 +101,14 @@
(should (null (duet--plan-safety "/a/f" "/b/f"
(list :file-type (lambda (_) 'file))))))
+(ert-deftest test-duet-safety-plan-detects-case-collision-via-caps ()
+ "The composite invokes the injected existing-names and case-fold predicates."
+ (let ((caps (list :file-type (lambda (_) 'file)
+ :existing-names (lambda (_) '("foo.txt"))
+ :case-insensitive (lambda (_) t))))
+ (should (cl-some (lambda (p) (eq 'case-collision (plist-get p :class)))
+ (duet--plan-safety "/a/Foo.txt" "/b/Foo.txt" caps)))))
+
(ert-deftest test-duet-safety-plan-collects-multiple-problems ()
"A pair tripping several checks reports each problem."
(let* ((caps (list :file-type (lambda (_) 'fifo)