annotate test/newsticker-testsuite.el @ 99682:ea8cf739773d

* international/mule-cmds.el (update-leim-list-file): Simplify. (prefer-coding-system, find-coding-systems-for-charsets): Fix docstring typos. (select-safe-coding-system, input-method-exit-on-first-char) (language-info-alist, language-info-custom-alist): Reflow docstrings. (toggle-input-method, read-multilingual-string): Doc fixes. Reflow docstrings. (locale-name-match, sort-coding-systems, find-multibyte-characters) (read-char-by-name): Use `string-match-p'. (get-char-code-property, put-char-code-property) (char-code-property-description): Be silent while loading uni-* files. (ucs-names): Use `dotimes-with-progress-reporter', because loading the Unicode character names is *slow*.
author Juanma Barranquero <lekktu@gmail.com>
date Tue, 18 Nov 2008 01:35:25 +0000
parents cbe26a0456e0
children f9cf5ec17443
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
95913
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
1 ;;; newsticker-testsuite.el --- Test suite for newsticker.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
2
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
3 ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
4 ;; Free Software Foundation, Inc.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
5
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
6 ;; Author: Ulf Jasper <ulf.jasper@web.de>
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
7 ;; Filename: newsticker-testsuite.el
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
8 ;; URL: http://www.nongnu.org/newsticker
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
9 ;; Keywords: News, RSS, Atom
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
10 ;; Time-stamp: "14. Juni 2008, 12:09:39 (ulf)"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
11
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
12 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
13
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
14 ;; This file is part of GNU Emacs.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
15
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
16 ;; GNU Emacs is free software: you can redistribute it and/or modify
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
17 ;; it under the terms of the GNU General Public License as published by
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
18 ;; the Free Software Foundation, either version 3 of the License, or
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
19 ;; (at your option) any later version.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
20
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
21 ;; GNU Emacs is distributed in the hope that it will be useful,
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
24 ;; GNU General Public License for more details.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
25
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
26 ;; You should have received a copy of the GNU General Public License
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
28
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
29 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
30
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
31 ;;; Commentary:
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
32
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
33 ;;; Code:
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
34
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
35 (require 'cl) ; assert
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
36
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
37 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
38 ;; Entry point
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
39 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
40 (defun newsticker--testsuite ()
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
41 "Unit test for newsticker.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
42 Subtests signal errors if something goes wrong."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
43 (interactive)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
44 (newsticker--test--guid)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
45 (newsticker--test--cache-contains)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
46 (newsticker--test--decode-iso8601-date)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
47 (newsticker--test--decode-rfc822-date)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
48 (newsticker--test--group-manage-orphan-feeds)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
49 (message "All tests passed successfully."))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
50
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
51 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
52 ;; Tests for newsticker-backend
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
53 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
54 (defun newsticker--test--guid ()
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
55 "Test `newsticker-guid-*'.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
56 Signals an error if something goes wrong."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
57 (assert (string= "blah" (newsticker--guid-to-string "blah")))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
58 (assert (string= "myguid" (newsticker--guid '("title1" "description1" "link1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
59 nil 'new 42 nil nil
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
60 ((guid () "myguid")))))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
61
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
62 (defun newsticker--test--cache-contains ()
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
63 "Test `newsticker--test--cache-contains'.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
64 Signals an error if something goes wrong."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
65 (let ((newsticker--cache '((feed1
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
66 ("title1" "description1" "link1" nil 'new 42
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
67 nil nil ((guid () "myguid")))))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
68 (newsticker--guid-to-string
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
69 (assoc 'guid (newsticker--extra '("title1" "description1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
70 "link1" nil 'new 42 nil nil
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
71 ((guid "myguid"))))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
72 (assert (newsticker--cache-contains newsticker--cache 'feed1 "WRONGTITLE"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
73 "description1" "link1" 'new "myguid"))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
74 (assert (not (newsticker--cache-contains newsticker--cache 'feed1 "title1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
75 "description1" "link1" 'new
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
76 "WRONG GUID")))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
77 (assert (newsticker--cache-contains newsticker--cache 'feed1 "title1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
78 "description1" "link1" 'new "myguid")))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
79 (let ((newsticker--cache '((feed1
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
80 ("title1" "description1" "link1" nil 'new 42
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
81 nil nil ((guid () "myguid1")))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
82 ("title1" "description1" "link1" nil 'new 42
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
83 nil nil ((guid () "myguid2")))))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
84 (assert (not (newsticker--cache-contains newsticker--cache 'feed1 "title1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
85 "description1" "link1" 'new
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
86 "myguid")))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
87 (assert (string= "myguid1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
88 (newsticker--guid (newsticker--cache-contains
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
89 newsticker--cache 'feed1 "title1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
90 "description1" "link1" 'new
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
91 "myguid1"))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
92 (assert (string= "myguid2"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
93 (newsticker--guid (newsticker--cache-contains
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
94 newsticker--cache 'feed1 "title1"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
95 "description1" "link1" 'new
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
96 "myguid2"))))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
97
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
98 (defun newsticker--do-test--decode-iso8601-date (input expected)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
99 "Actually test `newsticker--decode-iso8601-date'.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
100 Signals an error if iso8601-encoded INPUT does not match EXPECTED."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
101 (let ((result (format-time-string "%Y-%m-%dT%H:%M:%S"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
102 (newsticker--decode-iso8601-date input)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
103 t)))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
104 (assert (string= result expected)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
105 nil "Error decoding '%s': found '%s' but expected '%s'."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
106 input result expected)))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
107
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
108 (defun newsticker--test--decode-iso8601-date ()
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
109 "Test `newsticker--decode-iso8601-date'."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
110 (newsticker--decode-iso8601-date "2004-09-17T05:09:49+00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
111 (newsticker--decode-iso8601-date "2004-09-17T05:09+00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
112 (newsticker--decode-iso8601-date "2004-09-17T05:09:49")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
113 (newsticker--decode-iso8601-date "2004-09-17T05:09")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
114 (newsticker--decode-iso8601-date "2004-09-17")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
115 (newsticker--decode-iso8601-date "2004-09")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
116 (newsticker--do-test--decode-iso8601-date "2004"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
117 "2004-01-01T00:00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
118 (newsticker--do-test--decode-iso8601-date "2004-09"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
119 "2004-09-01T00:00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
120 (newsticker--do-test--decode-iso8601-date "2004-09-17"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
121 "2004-09-17T00:00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
122 (newsticker--do-test--decode-iso8601-date "2004-09-17T05:09"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
123 "2004-09-17T05:09:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
124 (newsticker--do-test--decode-iso8601-date "2004-09-17T05:09:49"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
125 "2004-09-17T05:09:49")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
126 (newsticker--do-test--decode-iso8601-date "2004-09-17T05:09:49.123"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
127 "2004-09-17T05:09:49")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
128 (newsticker--do-test--decode-iso8601-date "2004-09-17T05:09+01:00"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
129 "2004-09-17T04:09:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
130 (newsticker--do-test--decode-iso8601-date "2004-09-17T05:09-02:00"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
131 "2004-09-17T07:09:00"))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
132
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
133 (defun newsticker--do-test--decode-rfc822-date (input expected)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
134 "Actually test `newsticker--decode-rfc822-date'.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
135 Signals an error if rfc822-encoded INPUT does not match EXPECTED."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
136 (let ((result (format-time-string "%Y-%m-%dT%H:%M:%S"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
137 (newsticker--decode-rfc822-date input)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
138 t)))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
139 (assert (string= result expected)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
140 nil "Error decoding '%s': found '%s' but expected '%s'."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
141 input result expected)))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
142
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
143 (defun newsticker--test--decode-rfc822-date ()
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
144 "Test `newsticker--decode-rfc822-date'."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
145 (newsticker--do-test--decode-rfc822-date "Mon, 10 Mar 2008 19:27:52 +0100"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
146 "2008-03-10T18:27:52")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
147 ;;(format-time-string "%d.%m.%y, %H:%M %T%z"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
148 ;;(newsticker--decode-rfc822-date "Mon, 10 Mar 2008 19:27:52 +0200"))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
149
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
150 (newsticker--do-test--decode-rfc822-date "Mon, 10 Mar 2008 19:27:52"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
151 "2008-03-10T19:27:52")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
152 (newsticker--do-test--decode-rfc822-date "Mon, 10 Mar 2008 19:27"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
153 "2008-03-10T19:27:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
154 (newsticker--do-test--decode-rfc822-date "10 Mar 2008 19:27"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
155 "2008-03-10T19:27:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
156 (newsticker--do-test--decode-rfc822-date "Mon, 10 Mar 2008"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
157 "2008-03-10T00:00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
158 (newsticker--do-test--decode-rfc822-date "10 Mar 2008"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
159 "2008-03-10T00:00:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
160 (newsticker--do-test--decode-rfc822-date "Sat, 01 Dec 2007 00:05:00 +0100"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
161 "2007-11-30T23:05:00")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
162 (newsticker--do-test--decode-rfc822-date "Sun, 30 Dec 2007 18:58:13 +0100"
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
163 "2007-12-30T17:58:13"))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
164
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
165 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
166 ;; Tests for newsticker-treeview
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
167 ;; ======================================================================
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
168 (defun newsticker--test--group-manage-orphan-feeds ()
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
169 "Test `newsticker--group-manage-orphan-feeds'.
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
170 Signals an error if something goes wrong."
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
171 (let ((newsticker-groups '("Feeds"))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
172 (newsticker-url-list-defaults nil)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
173 (newsticker-url-list '(("feed1") ("feed2") ("feed3"))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
174 (newsticker--group-manage-orphan-feeds)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
175 (assert (equal '("Feeds" "feed3" "feed2" "feed1")
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
176 newsticker-groups))))
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
177
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
178 (provide 'newsticker-testsuite)
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
179
95955
cbe26a0456e0 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 95913
diff changeset
180 ;; arch-tag: e6c09af2-cc7a-4373-8f5f-9c36699ec34c
95913
e9cff1f5a026 Added newsticker-testsuite.el.
Ulf Jasper <ulf.jasper@web.de>
parents:
diff changeset
181 ;;; newsticker-testsuite.el ends here