123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- (require 'org-feed)
- (ert-deftest test-org-feed/fill-template ()
- "Test `org-feed-format-entry' template specifications."
-
-
-
- (should
- (equal "success!"
- (org-feed-format-entry nil "%(concat \"success\" \"!\")" nil)))
-
- (should
- (equal "[[https://orgmode.org]]\n"
- (org-feed-format-entry '(:link "https://orgmode.org") "%a" nil)))
-
- (should
- (equal (format-time-string (org-time-stamp-format nil nil))
- (org-feed-format-entry nil "%t" nil)))
- (should
- (string-match-p
- "<2016-01-02 \\S-+>"
- (org-feed-format-entry
- '(:pubDate "Sat, 02 Jan 2016 12:00:00 +0000") "%t" nil)))
- (should
- (equal (format-time-string (org-time-stamp-format t nil))
- (org-feed-format-entry nil "%T" nil)))
- (should
- (string-match-p
- "<2016-01-02 \\S-+ 12:00>"
- (org-feed-format-entry
- '(:pubDate "Sat, 02 Jan 2016 12:00:00 +0000") "%T" nil)))
-
- (should
- (equal (format-time-string (org-time-stamp-format nil t))
- (org-feed-format-entry nil "%u" nil)))
- (should
- (string-match-p
- "[2016-01-02 \\S-+]"
- (org-feed-format-entry
- '(:pubDate "Sat, 02 Jan 2016 12:00:00 +0000") "%u" nil)))
- (should
- (equal (format-time-string (org-time-stamp-format t t))
- (org-feed-format-entry nil "%U" nil)))
- (should
- (string-match-p
- "[2016-01-02 \\S-+ 12:00]"
- (org-feed-format-entry
- '(:pubDate "Sat, 02 Jan 2016 12:00:00 +0000") "%U" nil)))
-
-
- (should
- (equal "success!"
- (org-feed-format-entry '(:title "success!") "%h" nil)))
- (should
- (equal "%(concat \"no \" \"evaluation\")"
- (org-feed-format-entry
- '(:title "%(concat \"no \" \"evaluation\")") "%h" nil)))
-
- (should
- (equal "%h"
- (org-feed-format-entry '(:title "success!") "\\%h" nil)))
- (should
- (equal "\\success!"
- (org-feed-format-entry '(:title "success!") "\\\\%h" nil)))
- (should
- (equal "\\%h"
- (org-feed-format-entry '(:title "success!") "\\\\\\%h" nil)))
-
- (should
- (equal "success! success! success! success!"
- (org-feed-format-entry '(:title "success!") "%h %h %h %h" nil)))
-
-
- (should
- (equal
- "5 % Less (See\n Item \"3)\" Somewhere)"
- (org-feed-format-entry
- '(:title "5 % less (see\n item \"3)\" somewhere)")
- "%(capitalize \"%h\")" nil))))
- (provide 'test-org-feed)
|