X-Git-Url: https://gitweb.fperrin.net/?p=atom.git;a=blobdiff_plain;f=atom-tests.el;fp=atom-tests.el;h=a725a55ac3d607f7bc9e5e04d9870a1a2a3a8218;hp=3c5330c7b4e2058637d631cc95f735384f7c49f4;hb=839c46bcd6ebdfd548fde8a7a88dd84f420bf3af;hpb=ab998fcda8e13ac9068eada275365ab8ff8b822a diff --git a/atom-tests.el b/atom-tests.el index 3c5330c..a725a55 100644 --- a/atom-tests.el +++ b/atom-tests.el @@ -31,15 +31,16 @@ (ert-deftest text-feed () (let* ((user-full-name "John Smith") (user-mail-address "john.smith@example.org") - (my-atom-feed (atom-create "My feed" "http://example.org")) - (now (current-time))) + (now (current-time)) + (my-atom-feed (atom-create "My feed" "http://example.org" + (list :updated now)))) ;; A simple, text-only entry (atom-add-text-entry my-atom-feed "Hello world" "http://example.org/hello" "Hello the world!" - now) + (list :updated now)) ;; ;; @@ -71,6 +72,11 @@ (goto-char (point-min)) (should (re-search-forward exp-string)))) (goto-char (point-min)) + ;; there will be two updated elements, for the feed and the entry + (re-search-forward "updated>\\(.*\\)") + (let* ((updated-string (match-string 1)) + (updated-time (atom-parse-time updated-string))) + (should (equal updated-time (seq-take now 2)))) (re-search-forward "updated>\\(.*\\)") (let* ((updated-string (match-string 1)) (updated-time (atom-parse-time updated-string))) @@ -101,19 +107,35 @@ (ert-deftest atom-opt-elements () (let ((my-atom-feed (atom-create "My Feed" "http://example.org" - "Feed subtitle" ; subtitle - "http://example.org/feed.atom" ; self link - "urn:example-id" ; id - (cons "Author name" "Author addr") - "2024-04-23T01:02:03+04:00" ; updated - ))) + (list :subtitle "Feed subtitle" + :self "http://example.org/feed.atom" + :id "urn:example-id:1" + :author (list "Author name" "Author@example.org") + :updated (atom-parse-time "2024-03-23T01:02:03+04:00"))))) (atom-add-text-entry my-atom-feed "A text entry" "http://example.org/text" "Some text" - "2024-04-23T01:02:03+04:00" ; updated - (atom-generate-id "http://example.org/text" (current-time))))) + (list :updated (atom-parse-time "2024-03-23T01:02:04+0400") + :summary "summary")) + (atom-add-html-entry + my-atom-feed + "A HTLM entry" + "http://example.org/html" + "

Some text

" + (list :updated (atom-parse-time "2024-03-23T01:02:05+04:00") + :summary "

summary...

")) + (atom-add-xhtml-entry + my-atom-feed + "A XHTML entry" + "http://example.org/xhtml" + "

Some text

" + (list :updated (atom-parse-time "2024-03-23T01:02:06+04:00") + :summary "

summary...

")) + + (atom-print my-atom-feed) + (atom-print-as-rss my-atom-feed))) (provide 'atom-tests) ;;; atom-tests.el ends here