diff options
author | Leon Rische <leon.rische@me.com> | 2020-11-12 10:58:36 +0100 |
---|---|---|
committer | Leon Rische <leon.rische@me.com> | 2020-11-12 10:58:36 +0100 |
commit | 9f0f553ff03629637df55555fea51963a8d046e0 (patch) | |
tree | d3af16ba9c3a8ca88d17e34b56f4baa73a97cdeb /tests | |
parent | e25aea83e8dd0031ffb1c8ddfe3a02d45334aeec (diff) |
Add caching indexer prototype
Diffstat (limited to 'tests')
-rw-r--r-- | tests/org-fc-filter-test.el | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/org-fc-filter-test.el b/tests/org-fc-filter-test.el index 79b962c..13c5dcd 100644 --- a/tests/org-fc-filter-test.el +++ b/tests/org-fc-filter-test.el @@ -20,6 +20,11 @@ (equal (sort ids1 #'string-lessp) (sort ids2 #'string-lessp)))) +(defun org-fc-test-filter-index (index filter) + (cl-remove-if-not + (org-fc--compile-filter filter) + index)) + (ert-deftest org-fc-filter-test () (let* ((index (org-fc-awk-index-paths (list (org-fc-test-fixture "filter/"))))) ;; Index of all cards @@ -30,31 +35,31 @@ ;; Filter by type (should (org-fc-test-compare-ids - (org-fc-filter-index index '(type double)) + (org-fc-test-filter-index index '(type double)) '(a-double c-double))) ;; Filter by type, or (should (org-fc-test-compare-ids - (org-fc-filter-index index '(or (type cloze) (type double))) + (org-fc-test-filter-index index '(or (type cloze) (type double))) '(a-double c-double c-cloze))) ;; Filter by tag, direct (should (org-fc-test-compare-ids - (org-fc-filter-index index '(tag "tag1")) + (org-fc-test-filter-index index '(tag "tag1")) '(a-normal a-double))) ;; Filter by tag, inherited (should (org-fc-test-compare-ids - (org-fc-filter-index index '(tag "tag2")) + (org-fc-test-filter-index index '(tag "tag2")) '(a-double b-normal1))) ;; Filter by tag, filetag (should (org-fc-test-compare-ids - (org-fc-filter-index index '(and (tag "file1") + (org-fc-test-filter-index index '(and (tag "file1") (tag "file2") (tag "file3"))) '(c-double c-cloze))) @@ -62,12 +67,12 @@ ;; Negation (should (org-fc-test-compare-ids - (org-fc-filter-index index '(not (type normal))) + (org-fc-test-filter-index index '(not (type normal))) '(a-double c-double c-cloze))) ;; Combined (should (org-fc-test-compare-ids - (org-fc-filter-index index '(and (not (type normal)) + (org-fc-test-filter-index index '(and (not (type normal)) (tag "file1"))) '(c-double c-cloze))))) |