diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-11 17:17:53 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-11 17:17:53 -0500 |
| commit | e958410cbc14d2bfa0f97890aafe38031e082aa7 (patch) | |
| tree | f3dba16fd2c0aeb5cc7b50a67b8a559ebbdc0d69 /tests/test-calendar-sync-async-worker.el | |
| parent | 0ddbcde1e9f17021377f4160b39cd0790afcbdcc (diff) | |
| download | dotemacs-e958410cbc14d2bfa0f97890aafe38031e082aa7.tar.gz dotemacs-e958410cbc14d2bfa0f97890aafe38031e082aa7.zip | |
fix(calendar-sync): give the no-init .ics worker its module load-path
The async .ics-to-Org worker runs `emacs --batch --no-site-file --no-site-lisp' and loads `calendar-sync.el' by absolute path, but that doesn't make its sibling `(require 'cj-org-text-lib)' resolvable, so the conversion died with "Cannot open load file: cj-org-text-lib". `calendar-sync--worker-command' now inserts `-L <module-dir>' before `-l calendar-sync.el', which keeps the worker isolated from `init.el' while letting it load its local module deps. Updated the worker-command test and added a regression test that runs the real no-init worker shape.
Diffstat (limited to 'tests/test-calendar-sync-async-worker.el')
| -rw-r--r-- | tests/test-calendar-sync-async-worker.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test-calendar-sync-async-worker.el b/tests/test-calendar-sync-async-worker.el index d5982d32..6701df85 100644 --- a/tests/test-calendar-sync-async-worker.el +++ b/tests/test-calendar-sync-async-worker.el @@ -21,6 +21,8 @@ (should (member "--batch" command)) (should (member "--no-site-file" command)) (should (member "--no-site-lisp" command)) + (should (member "-L" command)) + (should (member "/tmp/" command)) (should (member "-l" command)) (should (member "/tmp/calendar-sync.el" command)) (should (cl-some (lambda (arg) @@ -35,6 +37,27 @@ (string-match-p "'(\"me@example\\.test\")" arg))) command)))) +(ert-deftest test-calendar-sync--worker-command-loads-sibling-modules-without-init () + "The worker command should load calendar-sync and sibling modules without init." + (let* ((calendar-sync--module-file + (expand-file-name "modules/calendar-sync.el" user-emacs-directory)) + (command (append + (calendar-sync--worker-command "/tmp/input.ics" "/tmp/output.org") + (list "--eval" "(princ \"loaded\")")))) + ;; Replace the conversion eval with a harmless smoke expression so this + ;; test exercises load-path setup without requiring temp ICS input. + (setq command + (cl-loop for arg in command + collect (if (and (stringp arg) + (string-match-p "calendar-sync--batch-convert-file" arg)) + "(princ \"\")" + arg))) + (with-temp-buffer + (let ((exit-code (apply #'call-process + (car command) nil t nil (cdr command)))) + (should (= 0 exit-code)) + (should (string-match-p "loaded" (buffer-string))))))) + (ert-deftest test-calendar-sync--batch-convert-file-writes-org-output () "The worker entry point should convert an ICS file and write Org output." (let* ((input-file (make-temp-file "calendar-sync-worker-" nil ".ics")) |
