summaryrefslogtreecommitdiff
path: root/tests/test-custom-org-agenda-functions.el.disabled
blob: 44f9f43d4cf335aa8a9f36a5443fd606d117ee33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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.