From 0930ec3c259d93a68fc59854677cdc7fef634e71 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 6 Jun 2026 11:37:39 -0500 Subject: 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. --- tests/test-duet-transfer.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/test-duet-transfer.el') diff --git a/tests/test-duet-transfer.el b/tests/test-duet-transfer.el index 84cf678..ebef0f9 100644 --- a/tests/test-duet-transfer.el +++ b/tests/test-duet-transfer.el @@ -180,6 +180,29 @@ (should (null (plist-get spec :argv))) (should (eq 'rsync-remote-to-remote (plist-get spec :exec-mode)))))) +(ert-deftest test-duet-transfer-spec-async-explicit-nil () + "An explicit :async nil in opts is honored rather than defaulting to t." + (test-duet-transfer--with-builtins + (let ((spec (duet--transfer-spec '("/tmp/a") "/tmp/b" '(:async nil)))) + (should (null (plist-get spec :async)))))) + +(ert-deftest test-duet-rsync-normalizer-classifies-known-stderr () + "The rsync backend's normalizer maps known stderr signatures to classes." + (test-duet-transfer--with-builtins + (let ((rsync (duet-backend-by-name 'rsync))) + (should (eq 'permission-denied + (plist-get (duet--normalize-failure + rsync '(:exit 23 :stderr "rsync: Permission denied (13)")) + :class))) + (should (eq 'destination-full + (plist-get (duet--normalize-failure + rsync '(:exit 11 :stderr "No space left on device")) + :class))) + (should (eq 'rsync-protocol-mismatch + (plist-get (duet--normalize-failure + rsync '(:exit 12 :stderr "protocol version mismatch")) + :class)))))) + ;;; Conflict planning — pure, prompt-free (ert-deftest test-duet-plan-conflicts-no-collisions-all-copy () -- cgit v1.2.3