summaryrefslogtreecommitdiff
path: root/tests/ss-org-tests.el
diff options
context:
space:
mode:
authorSzymon Szukalski <szymon@szymonszukalski.com>2026-04-10 17:59:11 +1000
committerSzymon Szukalski <szymon@szymonszukalski.com>2026-04-10 17:59:11 +1000
commit4b2d5710d6d4439281333a5be11fc7bcd9d3359e (patch)
treea995a1372d67828edea0d6225a694c3868714ae5 /tests/ss-org-tests.el
parent63797ae271dabdeb2e3bd54e103066e7c9ea4b3c (diff)
blank slate
Diffstat (limited to 'tests/ss-org-tests.el')
-rw-r--r--tests/ss-org-tests.el88
1 files changed, 0 insertions, 88 deletions
diff --git a/tests/ss-org-tests.el b/tests/ss-org-tests.el
deleted file mode 100644
index b8e1eb5..0000000
--- a/tests/ss-org-tests.el
+++ /dev/null
@@ -1,88 +0,0 @@
-;;; ss-org-tests.el --- Tests for ss-org -*- lexical-binding: t; -*-
-
-;;; Commentary:
-
-;; Focused ERT coverage for Org refile configuration.
-
-;;; Code:
-
-(add-to-list 'load-path (expand-file-name "../lisp" (file-name-directory load-file-name)))
-
-(require 'ert)
-(require 'cl-lib)
-(require 'org)
-(require 'ss-org)
-
-(ert-deftest ss-org-configure-refile-sets-org-variables ()
- (let ((old-refile-targets (and (boundp 'org-refile-targets)
- org-refile-targets))
- (old-refile-use-outline-path (and (boundp 'org-refile-use-outline-path)
- org-refile-use-outline-path))
- (old-outline-path-complete-in-steps
- (and (boundp 'org-outline-path-complete-in-steps)
- org-outline-path-complete-in-steps)))
- (unwind-protect
- (progn
- (advice-remove 'org-refile #'ss-org-refresh-agenda-files-for-refile)
- (setq org-refile-targets nil
- org-refile-use-outline-path nil
- org-outline-path-complete-in-steps t)
- (ss-org-configure-refile)
- (should (equal org-refile-targets
- '((org-agenda-files :regexp . "^\\*+ "))))
- (should (eq org-refile-use-outline-path 'file))
- (should-not org-outline-path-complete-in-steps))
- (setq org-refile-targets old-refile-targets
- org-refile-use-outline-path old-refile-use-outline-path
- org-outline-path-complete-in-steps
- old-outline-path-complete-in-steps)
- (advice-remove 'org-refile #'ss-org-refresh-agenda-files-for-refile))))
-
-(ert-deftest ss-org-configure-refile-discovers-headings-in-agenda-files ()
- (let* ((file (make-temp-file "ss-org-refile-" nil ".org"
- "* Alpha\n** Beta\n"))
- (file-name (file-name-nondirectory file))
- (org-agenda-files (list file))
- (old-refile-targets (and (boundp 'org-refile-targets)
- org-refile-targets))
- (old-refile-use-outline-path (and (boundp 'org-refile-use-outline-path)
- org-refile-use-outline-path))
- (old-outline-path-complete-in-steps
- (and (boundp 'org-outline-path-complete-in-steps)
- org-outline-path-complete-in-steps))
- targets)
- (unwind-protect
- (progn
- (advice-remove 'org-refile #'ss-org-refresh-agenda-files-for-refile)
- (ss-org-configure-refile)
- (with-current-buffer (find-file-noselect file)
- (setq targets (org-refile-get-targets)))
- (should (assoc (format "%s/Alpha" file-name) targets))
- (should (assoc (format "%s/Alpha/Beta" file-name) targets)))
- (setq org-refile-targets old-refile-targets
- org-refile-use-outline-path old-refile-use-outline-path
- org-outline-path-complete-in-steps
- old-outline-path-complete-in-steps)
- (advice-remove 'org-refile #'ss-org-refresh-agenda-files-for-refile)
- (when-let ((buffer (get-file-buffer file)))
- (kill-buffer buffer))
- (delete-file file))))
-
-(ert-deftest ss-org-configure-refile-adds-refresh-advice ()
- (unwind-protect
- (progn
- (advice-remove 'org-refile #'ss-org-refresh-agenda-files-for-refile)
- (ss-org-configure-refile)
- (should (advice-member-p #'ss-org-refresh-agenda-files-for-refile
- 'org-refile)))
- (advice-remove 'org-refile #'ss-org-refresh-agenda-files-for-refile)))
-
-(ert-deftest ss-org-refresh-agenda-files-for-refile-reuses-agenda-helper ()
- (let (called)
- (cl-letf (((symbol-function 'ss-refresh-org-agenda-files)
- (lambda (&rest _args)
- (setq called t))))
- (ss-org-refresh-agenda-files-for-refile)
- (should called))))
-
-;;; ss-org-tests.el ends here \ No newline at end of file