From e0e0ecdb86e3ae1772adcedb50e6c9caa210cf17 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 11 May 2026 18:17:22 -0500 Subject: test: close coverage gaps from the preceding batch Untested paths surfaced while reviewing the preceding feature/fix commits: - calendar-sync: a test that `-L' precedes `-l' in the worker command (separate `member' checks wouldn't catch a swap), plus a `:slow' tag on the real-subprocess worker test so it stays out of the default `make test' run. - org-capture cache: a killed marker buffer invalidates the entry and the next resolution rescans without erroring on the stale marker, `cj/org-capture-clear-target-cache' actually empties the hash, and non-`file+headline' targets (`file', `file+olp', `file+function') fall through to the original `org-capture-set-target-location'. - lorem-optimum: `cj/lipsum-title' on an empty chain returns "", not an error. - calibredb-epub: a negative `cj/nov-margin-percent' is clamped up to 0 (text takes the full window width). - mu4e attachments: the default save directory comes from the part's `:target-dir' and falls back to `~/Downloads/', and asking for the attachment at point on a header line fails with a `user-error'. --- tests/test-calendar-sync-async-worker.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tests/test-calendar-sync-async-worker.el') diff --git a/tests/test-calendar-sync-async-worker.el b/tests/test-calendar-sync-async-worker.el index 6701df85c..3bf803ec5 100644 --- a/tests/test-calendar-sync-async-worker.el +++ b/tests/test-calendar-sync-async-worker.el @@ -37,8 +37,21 @@ (string-match-p "'(\"me@example\\.test\")" arg))) command)))) +(ert-deftest test-calendar-sync--worker-command-puts-L-before-l () + "Order: `-L module-dir' must precede `-l calendar-sync.el' so the sibling +load-path entry is in effect by the time the module load runs. Asserting both +via `member' separately wouldn't catch a swap." + (let* ((calendar-sync--module-file "/tmp/calendar-sync.el") + (calendar-sync-past-months 2) + (calendar-sync-future-months 6) + (calendar-sync-user-emails '("me@example.test")) + (command (calendar-sync--worker-command "/tmp/input.ics" "/tmp/output.org"))) + (should (< (cl-position "-L" command :test #'equal) + (cl-position "-l" command :test #'equal))))) + (ert-deftest test-calendar-sync--worker-command-loads-sibling-modules-without-init () "The worker command should load calendar-sync and sibling modules without init." + :tags '(:slow) (let* ((calendar-sync--module-file (expand-file-name "modules/calendar-sync.el" user-emacs-directory)) (command (append -- cgit v1.2.3