123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- (ert-deftest test-org/split-string ()
- "Test `org-split-string' specifications."
-
- (should (equal '("a" "b") (org-split-string "a b" " ")))
-
- (should (equal '("a" "" "b") (org-split-string "a||b" "|")))
-
- (should (equal '("a" "b") (org-split-string "|a|b|" "|")))
-
-
- (should (equal '("") (org-split-string "")))
-
-
- (should-not (equal '("a" "b") (org-split-string "a b" " ")))
-
- (should (equal '("a" "b") (org-split-string "a \t\nb"))))
- (ert-deftest test-org/string-width ()
- "Test `org-string-width' specifications."
- (should (= 1 (org-string-width "a")))
- (should (= 0 (org-string-width "")))
-
- (should (= 0 (org-string-width #("a" 0 1 (invisible t)))))
- (should (= 1 (org-string-width #("ab" 0 1 (invisible t)))))
- (should (= 1 (org-string-width #("ab" 1 2 (invisible t)))))
- (should (= 3 (org-string-width
- #("abcde" 1 2 (invisible t) 3 4 (invisible t)))))
-
- (should (= 0 (let ((buffer-invisibility-spec t))
- (org-string-width #("a" 0 1 (invisible foo))))))
- (should (= 0 (let ((buffer-invisibility-spec '(foo)))
- (org-string-width #("a" 0 1 (invisible foo))))))
- (should (= 0 (let ((buffer-invisibility-spec '((foo . t))))
- (org-string-width #("a" 0 1 (invisible foo))))))
- (should (= 1 (let ((buffer-invisibility-spec '(bar)))
- (org-string-width #("a" 0 1 (invisible foo))))))
-
- (should (= 3 (org-string-width #("a" 0 1 (display "abc")))))
- (should (= 5 (org-string-width #("1a3" 1 2 (display "abc")))))
-
- (should (= 4 (org-string-width
- #("123" 1 2 (display #("abc" 1 2 (invisible t)))))))
-
- (should (= 2 (org-string-width #(" " 0 1 (display (space :width 2)))))))
- (ert-deftest test-org/in-regexp ()
- "Test `org-in-regexp' specifications."
-
- (should
- (org-test-with-temp-text "xx ab<point>c xx"
- (org-in-regexp "abc")))
- (should-not
- (org-test-with-temp-text "xx abc <point>xx"
- (org-in-regexp "abc")))
-
-
- (should
- (org-test-with-temp-text "abc xx ab<point>c xx"
- (org-in-regexp "abc")))
-
- (should-not
- (org-test-with-temp-text "A\nB<point>\nC"
- (org-in-regexp "A\nB\nC")))
- (should
- (org-test-with-temp-text "A\nB<point>\nC"
- (org-in-regexp "A\nB\nC" 1)))
- (should-not
- (org-test-with-temp-text "A\nB\nC<point>"
- (org-in-regexp "A\nB\nC" 1)))
-
-
- (should
- (org-test-with-temp-text "xx abc<point> xx"
- (org-in-regexp "abc")))
- (should-not
- (org-test-with-temp-text "xx abc<point> xx"
- (org-in-regexp "abc" nil t))))
- (ert-deftest test-org-matcher-time ()
- "Test `org-matcher-time'."
- (let ((system-time-locale "en_US"))
- (org-test-at-time "<2021-01-11 Mon 13:00>"
- (should (equal (list 0 0 13 11 1 2021)
- (butlast (org-decode-time (org-matcher-time "<now>"))
- 3)))
- (should (equal (list 0 0 0 14 1 2021)
- (butlast (org-decode-time (org-matcher-time "<+3d>"))
- 3)))
- (should (equal (list 0 0 0 9 1 2021)
- (butlast (org-decode-time (org-matcher-time "<-2d>"))
- 3)))
- (should (equal (list 0 0 0 18 1 2021)
- (butlast (org-decode-time (org-matcher-time "<+1w>"))
- 3)))
- (should (equal (list 0 0 17 11 1 2021)
- (butlast (org-decode-time (org-matcher-time "<+4h>"))
- 3)))
- (should (equal (list 0 0 11 11 1 2021)
- (butlast (org-decode-time (org-matcher-time "<-2h>"))
- 3)))
- (should (equal (list 0 0 3 12 1 2021)
- (butlast (org-decode-time (org-matcher-time "<+14h>"))
- 3))))))
- (provide 'test-org-macs)
|