[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/org-edna 7978874 24/72: Added tests for ids and match fin
From: |
Ian Dunn |
Subject: |
[elpa] scratch/org-edna 7978874 24/72: Added tests for ids and match finders |
Date: |
Sun, 21 May 2017 21:11:22 -0400 (EDT) |
branch: scratch/org-edna
commit 79788745d429221a791280eebf75e4a49050d26f
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] scratch/org-edna 3e1ed0c 29/72: Added re-search condition, (continued)
- [elpa] scratch/org-edna 3e1ed0c 29/72: Added re-search condition, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna c49aeba 36/72: Fixed consideration handling, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 1dfc66f 01/72: Initial Commit., Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna f05cf5e 23/72: Created finders for compatibility with org-depend, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna e8fc9d5 33/72: Added test for todo action, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 70f949c 35/72: Added note about quoting file names to documentation., Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 24a2837 38/72: Added tests for considerations, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 4b91a43 25/72: Added file for tests, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna bb284dc 27/72: Fixed parsing bug, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna d248565 21/72: Fix uses of substring, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 7978874 24/72: Added tests for ids and match finders,
Ian Dunn <=
- [elpa] scratch/org-edna 6448307 30/72: Added test for empty argument list, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 9e4d833 32/72: Fixed error in re-search, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna d022d2f 40/72: Added copyright and licensing information to all files, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 991782f 31/72: Added documentation for each condition, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna d527569 48/72: Handle all errors in Edna forms, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna f27a89f 45/72: Use example instead of src to make HTML export prettier, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna cc3cd47 22/72: Added configuration option to use inheritance, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 3cc0913 34/72: Added some more test headings, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 65d3049 37/72: Fix considerations, Ian Dunn, 2017/05/21
- [elpa] scratch/org-edna 1b492e1 42/72: Fixed copyright notices, Ian Dunn, 2017/05/21