[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b38a1ca 024/135: Added tests for ids and match finders
From: |
Ian Dunn |
Subject: |
[elpa] master b38a1ca 024/135: Added tests for ids and match finders |
Date: |
Mon, 17 Feb 2020 10:52:46 -0500 (EST) |
branch: master
commit b38a1ca616b2cc50ab46bd8d340af02b8cf8de51
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
Added tests for ids and match finders
---
org-edna-tests.el | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/org-edna-tests.el b/org-edna-tests.el
index 33665a4..d5f629c 100644
--- a/org-edna-tests.el
+++ b/org-edna-tests.el
@@ -59,6 +59,55 @@
(should (not modifier))
(should (= pos (length input-string))))))
+(defconst org-edna-test-dir
+ (expand-file-name (file-name-directory (or load-file-name
buffer-file-name))))
+
+(defconst org-edna-test-file
+ (expand-file-name "org-edna-tests.org" org-edna-test-dir))
+
+
+;; Finders
+
+(defsubst org-edna-heading (pom)
+ (org-with-point-at pom
+ (org-get-heading t t t t)))
+
+(ert-deftest org-edna-finder/match-single-arg ()
+ (let* ((org-agenda-files `(,org-edna-test-file))
+ (targets (org-edna-finder/match "test&1")))
+ (should (= (length targets) 2))
+ (should (string-equal (org-edna-heading (nth 0 targets)) "Tagged Heading
1"))
+ (should (string-equal (org-edna-heading (nth 1 targets)) "Tagged Heading
2"))))
+
+(ert-deftest org-edna-finder/ids-single ()
+ (let* ((org-agenda-files `(,org-edna-test-file))
+ (test-id "caccd0a6-d400-410a-9018-b0635b07a37e")
+ (targets (org-edna-finder/ids test-id)))
+ (should (= (length targets) 1))
+ (should (string-equal (org-edna-heading (nth 0 targets)) "Blocking Test"))
+ (should (string-equal (org-entry-get (nth 0 targets) "ID") test-id))))
+
+(ert-deftest org-edna-finder/ids-multiple ()
+ (let* ((org-agenda-files `(,org-edna-test-file))
+ (test-ids '("0d491588-7da3-43c5-b51a-87fbd34f79f7"
+ "b010cbad-60dc-46ef-a164-eb155e62cbb2"))
+ (targets (apply 'org-edna-finder/ids test-ids)))
+ (should (= (length targets) 2))
+ (should (string-equal (org-edna-heading (nth 0 targets)) "ID Heading 1"))
+ (should (string-equal (org-entry-get (nth 0 targets) "ID") (nth 0
test-ids)))
+ (should (string-equal (org-edna-heading (nth 1 targets)) "ID Heading 2"))
+ (should (string-equal (org-entry-get (nth 1 targets) "ID") (nth 1
test-ids)))))
+
+(ert-deftest org-edna-finder/match-blocker ()
+ (let* ((org-agenda-files `(,org-edna-test-file))
+ (heading (org-id-find "caccd0a6-d400-410a-9018-b0635b07a37e" t))
+ (blocker (org-entry-get heading "BLOCKER")))
+ (should (string-equal "match(test&1)" blocker))
+ (org-with-point-at heading
+ (org-edna-process-form blocker 'condition))
+ (should (string-equal (substring-no-properties org-block-entry-blocking)
+ "TODO Tagged Heading 1 :1:test:"))))
+
(provide 'org-edna-tests)
;;; org-edna-tests.el ends here
- [elpa] master 9f27779 014/135: Clarified use of case-fold-search in `org-bat--handle-planning', (continued)
- [elpa] master 9f27779 014/135: Clarified use of case-fold-search in `org-bat--handle-planning', Ian Dunn, 2020/02/17
- [elpa] master 13e752b 021/135: Fix uses of substring, Ian Dunn, 2020/02/17
- [elpa] master 3937f31 009/135: Fixed headings condition, Ian Dunn, 2020/02/17
- [elpa] master 975da4b 010/135: Improved org-bat-parse-form to handle new argument types, Ian Dunn, 2020/02/17
- [elpa] master 029bc2e 012/135: Cleaned up condition handling, Ian Dunn, 2020/02/17
- [elpa] master 602ad6d 011/135: Added tests for org-bat-parse-form, Ian Dunn, 2020/02/17
- [elpa] master a70f9ac 016/135: Fixed bug in Makefile, Ian Dunn, 2020/02/17
- [elpa] master abb0083 018/135: Fixed up indenting, Ian Dunn, 2020/02/17
- [elpa] master cb1f51f 020/135: Don't assume arguments will be symbols or strings, Ian Dunn, 2020/02/17
- [elpa] master 180d05b 022/135: Added configuration option to use inheritance, Ian Dunn, 2020/02/17
- [elpa] master b38a1ca 024/135: Added tests for ids and match finders,
Ian Dunn <=
- [elpa] master 30fc4cd 023/135: Created finders for compatibility with org-depend, Ian Dunn, 2020/02/17
- [elpa] master 9916819 028/135: Added test for parsing multiple forms, Ian Dunn, 2020/02/17
- [elpa] master fc0dcc1 029/135: Added re-search condition, Ian Dunn, 2020/02/17
- [elpa] master c675036 030/135: Added test for empty argument list, Ian Dunn, 2020/02/17
- [elpa] master 7a3332d 032/135: Fixed error in re-search, Ian Dunn, 2020/02/17
- [elpa] master 6470c5f 033/135: Added test for todo action, Ian Dunn, 2020/02/17
- [elpa] master db23e3f 034/135: Added some more test headings, Ian Dunn, 2020/02/17
- [elpa] master aa259f0 037/135: Fix considerations, Ian Dunn, 2020/02/17
- [elpa] master f80835a 038/135: Added tests for considerations, Ian Dunn, 2020/02/17
- [elpa] master 729a391 040/135: Added copyright and licensing information to all files, Ian Dunn, 2020/02/17