12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- (require 'org-capture)
- (ert-deftest test-org-capture/fill-template ()
- "Test `org-capture-fill-template' specifications."
-
- (should
- (equal "success!\n"
- (org-capture-fill-template "%(concat \"success\" \"!\")")))
-
- (should
- (equal (concat (format-time-string "%Y") "\n")
- (org-capture-fill-template "%<%Y>")))
-
- (should
- (equal (concat (format-time-string (car org-time-stamp-formats)) "\n")
- (org-capture-fill-template "%t")))
- (should
- (equal (concat (format-time-string (cdr org-time-stamp-formats)) "\n")
- (org-capture-fill-template "%T")))
-
- (should
- (string-match-p
- (format-time-string (substring (car org-time-stamp-formats) 1 -1))
- (org-capture-fill-template "%u")))
- (should
- (string-match-p
- (format-time-string (substring (cdr org-time-stamp-formats) 1 -1))
- (org-capture-fill-template "%U")))
-
-
- (should
- (equal "success!\n"
- (let ((org-store-link-plist nil))
- (org-capture-fill-template "%i" "success!"))))
- (should-not
- (equal "failure!\n"
- (let ((org-store-link-plist nil))
- (org-capture-fill-template "%i" "%(concat \"failure\" \"!\")"))))
-
- (should
- (equal "%i\n"
- (let ((org-store-link-plist nil))
- (org-capture-fill-template "\\%i" "success!"))))
- (should
- (equal "\\success!\n"
- (let ((org-store-link-plist nil))
- (org-capture-fill-template "\\\\%i" "success!"))))
- (should
- (equal "\\%i\n"
- (let ((org-store-link-plist nil))
- (org-capture-fill-template "\\\\\\%i" "success!")))))
- (provide 'test-org-capture)
|