summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-22 12:23:13 -0500
committerCraig Jennings <c@cjennings.net>2024-04-22 12:23:13 -0500
commit2dd3aed6971fe74915c1fc09b4de20a6c64e817b (patch)
treef9d896ebcfd0e6a2acb2684ff085a42324a9a638 /tests
parent5d18558615a127640d6b4e634997ee35a5fe1b77 (diff)
New Custom Functions, Org Updates, Agenda Updates, &c.
=== Functions === - add function cj/dired-convert-image-to-jpeg - add function cj/dired-copy-path-as-kill - add function cj/export-org-to-md-on-save function - add function cj/org-link-to-current-file === Agenda === - rework the f8 main agenda into custom agenda using Aaron Bieber's ideas - agenda lists now use standard agenda functions - updated packages to remove org-super-agenda and ts (a dependency) - file commentary text updated to reflect the change === Org === - add grocery and shopping list capture items - add missing tests for org-skip-subtree-if-habit - add support for org-habits, including checkboxes - fix issue with org-auto-export-to-md - modularize org-agenda - move todo settings to org-config - reformat org-roam-config === &c. === - add day to sortable date - add disablefastrenderer to hugo server flags - add fill column indicator when emacs lisping - add gpt buffers to the bury-alive-list - add keybinding for fixup-whitespace - add magit cloning settings - finish automatically on "Link" capture - fix company complaints about shutting up function - fix em, e, ff, and f eshell aliases - make fallback theme modus-vivendi - prune the compilation cache when applicable
Diffstat (limited to 'tests')
-rw-r--r--tests/test-custom-org-agenda-functions.el94
1 files changed, 94 insertions, 0 deletions
diff --git a/tests/test-custom-org-agenda-functions.el b/tests/test-custom-org-agenda-functions.el
new file mode 100644
index 00000000..44f9f43d
--- /dev/null
+++ b/tests/test-custom-org-agenda-functions.el
@@ -0,0 +1,94 @@
+;;; test-custom-org-agenda-functions.el --- Tests for custom functions in org-agenda -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; This tests the custom functions created to build the main agenda in org-agenda-config.el
+
+;;; Code:
+
+(add-to-list 'load-path (concat user-emacs-directory "modules"))
+(require 'org-agenda-config)
+
+(ert-deftest test-cj/org-skip-subtree-if-habit-positive ()
+ (with-temp-buffer
+ (insert "* TODO [#A] Test task\n")
+ (insert ":PROPERTIES:\n")
+ (insert ":STYLE: habit\n")
+ (insert ":RESET_CHECK_BOXES: t\n")
+ (insert ":END:\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (not (eq nil (cj/org-skip-subtree-if-habit))))))
+
+(ert-deftest test-cj/org-skip-subtree-if-habit-negative ()
+ (with-temp-buffer
+ (insert "* TODO [#A] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-habit)))))
+
+(ert-deftest test-cj/org-skip-subtree-if-priority-positive ()
+ (with-temp-buffer
+ (insert "* TODO [#A] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (not (eq nil (cj/org-skip-subtree-if-priority ?A))))))
+
+(ert-deftest test-cj/org-skip-subtree-if-priority-negative ()
+ (erase-buffer)
+ (insert "* TODO [#B] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-priority ?A))))
+
+(ert-deftest test-cj/org-skip-subtree-if-priority-boundary0 ()
+ (erase-buffer)
+ (insert "* TODO Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-priority ?A))))
+
+(ert-deftest test-cj/org-skip-subtree-if-priority-boundary1 ()
+ (erase-buffer)
+ (insert "* Test entry\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-priority ?A))))
+
+(ert-deftest test-cj/org-skip-subtree-if-keyword-positive ()
+ (with-temp-buffer
+ (insert "* TODO [#A] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (not (eq nil (cj/org-skip-subtree-if-keyword '("TODO")))))))
+
+(ert-deftest test-cj/org-skip-subtree-if-keyword-positive-multiple ()
+ (with-temp-buffer
+ (insert "* PROJECT Test entry\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (not (eq nil (cj/org-skip-subtree-if-keyword '("TODO" "PROJECT")))))))
+
+(ert-deftest test-cj/org-skip-subtree-if-keyword-negative ()
+ (erase-buffer)
+ (insert "* PROJECT [#A] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-keyword '("TODO")))))
+
+(ert-deftest test-cj/org-skip-subtree-if-keyword-negative-superset ()
+ (erase-buffer)
+ (insert "* PROJECT [#A] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-keyword '("TODOTODO")))))
+
+(ert-deftest test-cj/org-skip-subtree-if-keyword-negative-multiple ()
+ (erase-buffer)
+ (insert "* PROJECT [#A] Test task\n")
+ (org-mode)
+ (goto-char (point-min))
+ (should (eq nil (cj/org-skip-subtree-if-keyword '("TODO" "DONE")))))
+
+
+(provide 'test-custom-org-agenda-functions)
+;;; test-custom-org-agenda-functions.el ends here.