1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-07 12:20:39 -08:00

Merge from trunk.

This commit is contained in:
Paul Eggert 2011-09-28 13:07:17 -07:00
commit b13f71e2dd
26 changed files with 264 additions and 142 deletions

View file

@ -1,3 +1,8 @@
2011-09-28 Eli Zaretskii <eliz@gnu.org>
* INSTALL: Mention that m17n libraries and libotf are needed for
Arabic shaping.
2011-09-26 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib, improving some licensing wording.

22
INSTALL
View file

@ -111,15 +111,16 @@ ADDITIONAL DISTRIBUTION FILES
* Complex Text Layout support libraries
Emacs needs the optional libraries "m17n-db", "libm17n-flt", "libotf"
to correctly display such complex scripts as Indic and Khmer.
On some systems, particularly GNU/Linux, these libraries may be
already present or available as additional packages. Note that if
there is a separate `dev' or `devel' package, for use at compilation
time rather than run time, you will need that as well as the
corresponding run time package; typically the dev package will contain
header files and a library archive. Otherwise, you can download and
build libraries from sources.
On GNU and Unix systems, Emacs needs the optional libraries "m17n-db",
"libm17n-flt", "libotf" to correctly display such complex scripts as
Indic and Khmer, and also for scripts that require Arabic shaping
support (Arabic and Farsi). On some systems, particularly GNU/Linux,
these libraries may be already present or available as additional
packages. Note that if there is a separate `dev' or `devel' package,
for use at compilation time rather than run time, you will need that
as well as the corresponding run time package; typically the dev
package will contain header files and a library archive. Otherwise,
you can download and build libraries from sources.
The sources of these libraries are available by anonymous CVS from
cvs.m17n.org.
@ -133,6 +134,9 @@ For m17n-lib, if you have problems with making the whole package
because you lack some other packages on which m17n-lib depends, try to
configure it with the option "--without-gui".
Note that Emacs cannot support complex scripts on a TTY, unless the
terminal includes such a support.
* intlfonts-VERSION.tar.gz
The intlfonts distribution contains X11 fonts in various encodings

View file

@ -1,3 +1,7 @@
2011-09-28 Juanma Barranquero <lekktu@gmail.com>
* windows.texi (Splitting Windows): Fix typos.
2011-09-25 Martin Rudalics <rudalics@gmx.at>
* windows.texi (Windows and Frames, Display Action Functions)

View file

@ -1178,7 +1178,7 @@ equivalently, @code{(split-window W3 -8 'left)} should now produce the
penultimate configuration from the previous scenario from where we can
continue as described before.
Another strategy starts with splitting an inital window @code{W6} by
Another strategy starts with splitting an initial window @code{W6} by
evaluating @code{(split-window W6 nil nil t)} with the following result:
@smallexample
@group
@ -1259,11 +1259,11 @@ configuration.
@defopt window-splits
If this variable is nil, the function @code{split-window} can split a
window if and only if that window's screen estate is sufficiently large
to accomodate both--itself and the new window.
to accommodate both--itself and the new window.
If this variable is non-@code{nil}, @code{split-window} tries to resize
all windows that are part of the same combination as the old window to
accomodate the new window. Hence, the new window can be also created if
accommodate the new window. Hence, the new window can be also created if
the old window is of fixed size or too small to split (@pxref{Window
Sizes}).

View file

@ -1,3 +1,37 @@
2011-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
* progmodes/perl-mode.el (perl-syntax-propertize-function):
Don't confuse "y => 3" as the beginning of a `y' operation.
* emacs-lisp/debug.el (debug-convert-byte-code): Don't assume the
object has more than 4 slots (bug#9613).
2011-09-28 Juanma Barranquero <lekktu@gmail.com>
* subr.el (with-output-to-temp-buffer):
* net/quickurl.el (quickurl, quickurl-browse-url):
Fix typos in docstrings.
2011-09-27 Eli Zaretskii <eliz@gnu.org>
* minibuffer.el (completion-styles)
(completion-category-overrides): Cross reference each other in doc
strings.
2011-09-27 Glenn Morris <rgm@gnu.org>
* pcmpl-cvs.el (pcmpl-cvs-entries): Update for Emacs 22.1 changes
to split-string. (Bug#9606)
2011-09-27 Lars Magne Ingebrigtsen <larsi@gnus.org>
* mail/smtpmail.el (smtpmail-via-smtp): Fix STARTTLS detection
(bug#9615).
2011-09-27 Chong Yidong <cyd@stupidchicken.com>
* emacs-lisp/package.el (list-packages): Fix echo area message.
2011-09-27 Leo Liu <sdl.web@gmail.com>
* ido.el (ido-read-internal): Accept cons cell HIST arg.

View file

@ -1743,7 +1743,7 @@
auto-composition-function to it.
(toggle-auto-composition): New function.
* international/characters.el: Make all chararacters in the
* international/characters.el: Make all characters in the
charset tibetan to tibetan script.
* international/mule-conf.el (tibetan): Fix :code-space property.

View file

@ -869,8 +869,10 @@ To specify a nil argument interactively, exit with an empty minibuffer."
,defn
,@(remq '&rest (remq '&optional args))))))
(if (> (length defn) 5)
;; The mere presence of field 5 is sufficient to make
;; it interactive.
(push `(interactive ,(aref defn 5)) body))
(if (aref defn 4)
(if (and (> (length defn) 4) (aref defn 4))
;; Use `documentation' here, to get the actual string,
;; in case the compiled function has a reference
;; to the .elc file.

View file

@ -1658,10 +1658,11 @@ The list is displayed in a buffer named `*Packages*'."
(switch-to-buffer buf))
(let ((upgrades (package-menu--find-upgrades)))
(if upgrades
(message "%d package%s can be upgraded; type `%s' to mark them for upgrading."
(message "%d package%s can be upgraded; type `%s' to mark %s for upgrading."
(length upgrades)
(if (= (length upgrades) 1) "" "s")
(substitute-command-keys "\\[package-menu-mark-upgrades]")))))
(substitute-command-keys "\\[package-menu-mark-upgrades]")
(if (= (length upgrades) 1) "it" "them")))))
;;;###autoload
(defalias 'package-list-packages 'list-packages)

View file

@ -3,6 +3,11 @@
* plstore.el (plstore-select-keys, plstore-encrypt-to): Clarify
documentation.
2011-09-27 Lars Magne Ingebrigtsen <larsi@gnus.org>
* gnus-uu.el (gnus-uu-grab-articles): Require gnus-async so that
`gnus-asynchronous' isn't shadowed.
2011-09-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
* nnimap.el (nnimap-wait-for-response): Message less (bug#9540).

View file

@ -1290,6 +1290,7 @@ When called interactively, prompt for REGEXP."
;; the process-function has been successful and nil otherwise.
(defun gnus-uu-grab-articles (articles process-function
&optional sloppy limit no-errors)
(require 'gnus-async)
(let ((state 'first)
(gnus-asynchronous nil)
(gnus-inhibit-treatment t)

View file

@ -658,7 +658,7 @@ The list is in preference order.")
:always-query-capabilities t
:starttls-function
(lambda (capabilities)
(and (string-match "-STARTTLS" capabilities)
(and (string-match "[ -]STARTTLS" capabilities)
"STARTTLS\r\n"))
:client-certificate t
:use-starttls-if-possible t)))

View file

@ -482,7 +482,10 @@ and DOC describes the way this style of completion works.")
;; and simply add "bar" to the end of the result.
emacs22)
"List of completion styles to use.
The available styles are listed in `completion-styles-alist'."
The available styles are listed in `completion-styles-alist'.
Note that `completion-category-overrides' may override these
styles for specific categories, such as files, buffers, etc."
:type `(repeat (choice ,@(mapcar (lambda (x) (list 'const (car x)))
completion-styles-alist)))
:group 'minibuffer
@ -490,7 +493,7 @@ The available styles are listed in `completion-styles-alist'."
(defcustom completion-category-overrides
'((buffer (styles . (basic substring))))
"List of overrides for specific categories.
"List of `completion-styles' overrides for specific categories.
Each override has the shape (CATEGORY . ALIST) where ALIST is
an association list that can specify properties such as:
- `styles': the list of `completion-styles' to use for that category.

View file

@ -307,7 +307,7 @@ Also display a `message' saying what the URL was unless SILENT is non-nil."
"Insert a URL based on LOOKUP.
If not supplied LOOKUP is taken to be the word at point in the current
buffer, this default action can be modifed via
buffer, this default action can be modified via
`quickurl-grab-lookup-function'."
(interactive)
(when (or lookup
@ -402,7 +402,7 @@ is decided."
"Browse the URL associated with LOOKUP.
If not supplied LOOKUP is taken to be the word at point in the
current buffer, this default action can be modifed via
current buffer, this default action can be modified via
`quickurl-grab-lookup-function'."
(interactive)
(when (or lookup

View file

@ -1,3 +1,9 @@
2011-09-27 Eli Zaretskii <eliz@gnu.org>
* org.el (org-mode): Force left-to-right paragraphs in Org
buffers. For a related discussions, see
https://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00349.html.
2011-09-17 Juanma Barranquero <lekktu@gmail.com>
* org.el (org-toggle-pretty-entities): Fix typo in message.

View file

@ -4748,6 +4748,7 @@ The following commands are available:
(org-set-local 'line-move-ignore-invisible t))
(org-set-local 'outline-regexp org-outline-regexp)
(org-set-local 'outline-level 'org-outline-level)
(setq bidi-paragraph-direction 'left-to-right)
(when (and org-ellipsis
(fboundp 'set-display-table-slot) (boundp 'buffer-display-table)
(fboundp 'make-glyph-code))

View file

@ -169,13 +169,13 @@ operation character applies, as displayed by 'cvs -n update'."
(insert-file-contents (concat dir "CVS/Entries"))
(goto-char (point-min))
(while (not (eobp))
(let* ((line (buffer-substring (line-beginning-position)
(line-end-position)))
(fields (split-string line "/"))
text)
(if (eq (aref line 0) ?/)
(setq fields (cons "" fields)))
(setq text (nth 1 fields))
;; Normal file: /NAME -> "" "NAME"
;; Directory : D/NAME -> "D" "NAME"
(let* ((fields (split-string (buffer-substring
(line-beginning-position)
(line-end-position))
"/"))
(text (nth 1 fields)))
(when text
(if (string= (nth 0 fields) "D")
(setq text (file-name-as-directory text)))

View file

@ -304,11 +304,12 @@ The expansion is entirely correct because it uses the C preprocessor."
(put-text-property (match-beginning 2) (match-end 2)
'syntax-table (string-to-syntax "\""))
(perl-syntax-propertize-special-constructs end)))))
("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\([^])}> \n\t]\\)"
("\\(^\\|[?:.,;=!~({[ \t]\\)\\([msy]\\|q[qxrw]?\\|tr\\)\\>\\s-*\\(?:\\([^])}>= \n\t]\\)\\|\\(?3:=\\)[^>]\\)"
;; Nasty cases:
;; /foo/m $a->m $#m $m @m %m
;; \s (appears often in regexps).
;; -s file
;; y => 3
;; sub tr {...}
(3 (ignore
(if (save-excursion (goto-char (match-beginning 0))

View file

@ -3002,7 +3002,7 @@ Instead it binds `standard-output' to that buffer, so that output
generated with `prin1' and similar functions in BODY goes into
the buffer.
At the end of BODY, this marks buffer BUFNAME unmodifed and displays
At the end of BODY, this marks buffer BUFNAME unmodified and displays
it in a window, but does not select it. The normal way to do this is
by calling `display-buffer', then running `temp-buffer-show-hook'.
However, if `temp-buffer-show-function' is non-nil, it calls that

View file

@ -1,4 +1,4 @@
2011-09-27 Paul Eggert <eggert@cs.ucla.edu>
2011-09-28 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
(allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE)
@ -775,6 +775,27 @@
rather than rolling our own approximation.
(SCROLL_BAR_VEC_SIZE): Remove; not used.
2011-09-28 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (compute_display_string_end): If there's no display
string at CHARPOS, return -1.
* bidi.c (bidi_fetch_char): When compute_display_string_end
returns a negative value, treat the character as a normal
character not covered by a display string. (Bug#9624)
2011-09-28 Juanma Barranquero <lekktu@gmail.com>
* lread.c (Fread_from_string): Fix typo in docstring.
2011-09-27 Eli Zaretskii <eliz@gnu.org>
* xdisp.c (handle_invisible_prop): If invisible text ends on a
newline, reseat the iterator instead of bidi-iterating there one
character at a time. (Bug#9610)
(BUFFER_POS_REACHED_P, move_it_in_display_line_to): Bail when past
TO_CHARPOS if the bidi iterator is at base embedding level.
2011-09-27 Andreas Schwab <schwab@linux-m68k.org>
* lread.c (readevalloop): Use correct code for NBSP.

View file

@ -4547,7 +4547,7 @@
* composite.c (composition_compute_stop_pos): In forward search,
pay attention to the possibility that some character after ENDPOS
will be composed with charactrs before ENDPOS.
will be composed with characters before ENDPOS.
2010-08-24 Chong Yidong <cyd@stupidchicken.com>

View file

@ -10460,7 +10460,7 @@
(Fkey_description): Likewise.
* lread.c (read1): On reading multibyte string, be sure to make
all 8-bit chararacters in valid multibyte form.
all 8-bit characters in valid multibyte form.
(readchar): Use FETCH_STRING_CHAR_ADVANCE unconditionally.
* print.c (print_object): Use FETCH_STRING_CHAR_ADVANCE

View file

@ -974,6 +974,15 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
ch = 0xFFFC;
}
disp_end_pos = compute_display_string_end (*disp_pos, string);
if (disp_end_pos < 0)
{
/* Somebody removed the display string from the buffer
behind our back. Recover by processing this buffer
position as if no display property were present there to
begin with. */
*disp_prop = 0;
goto normal_char;
}
*nchars = disp_end_pos - *disp_pos;
if (*nchars <= 0)
abort ();
@ -988,6 +997,7 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
}
else
{
normal_char:
if (string->s)
{
int len;

View file

@ -1971,7 +1971,7 @@ DEFUN ("read-from-string", Fread_from_string, Sread_from_string, 1, 3, 0,
doc: /* Read one Lisp expression which is represented as text by STRING.
Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
FINAL-STRING-INDEX is an integer giving the position of the next
remaining chararacter in STRING.
remaining character in STRING.
START and END optionally delimit a substring of STRING from which to read;
they default to 0 and (length STRING) respectively. */)
(Lisp_Object string, Lisp_Object start, Lisp_Object end)

View file

@ -3389,9 +3389,10 @@ compute_display_string_pos (struct text_pos *position,
}
/* Return the character position of the end of the display string that
started at CHARPOS. A display string is either an overlay with
`display' property whose value is a string or a `display' text
property whose value is a string. */
started at CHARPOS. If there's no display string at CHARPOS,
return -1. A display string is either an overlay with `display'
property whose value is a string or a `display' text property whose
value is a string. */
ptrdiff_t
compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string)
{
@ -3405,8 +3406,22 @@ compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string)
if (charpos >= eob || (string->s && !STRINGP (object)))
return eob;
/* It could happen that the display property or overlay was removed
since we found it in compute_display_string_pos above. One way
this can happen is if JIT font-lock was called (through
handle_fontified_prop), and jit-lock-functions remove text
properties or overlays from the portion of buffer that includes
CHARPOS. Muse mode is known to do that, for example. In this
case, we return -1 to the caller, to signal that no display
string is actually present at CHARPOS. See bidi_fetch_char for
how this is handled.
An alternative would be to never look for display properties past
it->stop_charpos. But neither compute_display_string_pos nor
bidi_fetch_char that calls it know or care where the next
stop_charpos is. */
if (NILP (Fget_char_property (pos, Qdisplay, object)))
abort ();
return -1;
/* Look forward for the first character where the `display' property
changes. */
@ -4059,40 +4074,67 @@ handle_invisible_prop (struct it *it)
/* The position newpos is now either ZV or on visible text. */
if (it->bidi_p && newpos < ZV)
{
/* With bidi iteration, the region of invisible text
could start and/or end in the middle of a non-base
embedding level. Therefore, we need to skip
invisible text using the bidi iterator, starting at
IT's current position, until we find ourselves
outside the invisible text. Skipping invisible text
_after_ bidi iteration avoids affecting the visual
order of the displayed text when invisible properties
are added or removed. */
if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
ptrdiff_t bpos = CHAR_TO_BYTE (newpos);
if (FETCH_BYTE (bpos) == '\n'
|| (newpos > BEGV && FETCH_BYTE (bpos - 1) == '\n'))
{
/* If we were `reseat'ed to a new paragraph,
determine the paragraph base direction. We need
to do it now because next_element_from_buffer may
not have a chance to do it, if we are going to
skip any text at the beginning, which resets the
FIRST_ELT flag. */
bidi_paragraph_init (it->paragraph_embedding,
&it->bidi_it, 1);
/* If the invisible text ends on a newline or the
character after a newline, we can avoid the
costly, character by character, bidi iteration to
newpos, and instead simply reseat the iterator
there. That's because all bidi reordering
information is tossed at the newline. This is a
big win for modes that hide complete lines, like
Outline, Org, etc. (Implementation note: the
call to reseat_1 is necessary, because it signals
to the bidi iterator that it needs to reinit its
internal information when the next element for
display is requested. */
struct text_pos tpos;
SET_TEXT_POS (tpos, newpos, bpos);
reseat_1 (it, tpos, 0);
}
do
else /* Must use the slow method. */
{
bidi_move_to_visually_next (&it->bidi_it);
/* With bidi iteration, the region of invisible text
could start and/or end in the middle of a
non-base embedding level. Therefore, we need to
skip invisible text using the bidi iterator,
starting at IT's current position, until we find
ourselves outside the invisible text. Skipping
invisible text _after_ bidi iteration avoids
affecting the visual order of the displayed text
when invisible properties are added or
removed. */
if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV)
{
/* If we were `reseat'ed to a new paragraph,
determine the paragraph base direction. We
need to do it now because
next_element_from_buffer may not have a
chance to do it, if we are going to skip any
text at the beginning, which resets the
FIRST_ELT flag. */
bidi_paragraph_init (it->paragraph_embedding,
&it->bidi_it, 1);
}
do
{
bidi_move_to_visually_next (&it->bidi_it);
}
while (it->stop_charpos <= it->bidi_it.charpos
&& it->bidi_it.charpos < newpos);
IT_CHARPOS (*it) = it->bidi_it.charpos;
IT_BYTEPOS (*it) = it->bidi_it.bytepos;
/* If we overstepped NEWPOS, record its position in
the iterator, so that we skip invisible text if
later the bidi iteration lands us in the
invisible region again. */
if (IT_CHARPOS (*it) >= newpos)
it->prev_stop = newpos;
}
while (it->stop_charpos <= it->bidi_it.charpos
&& it->bidi_it.charpos < newpos);
IT_CHARPOS (*it) = it->bidi_it.charpos;
IT_BYTEPOS (*it) = it->bidi_it.bytepos;
/* If we overstepped NEWPOS, record its position in the
iterator, so that we skip invisible text if later the
bidi iteration lands us in the invisible region
again. */
if (IT_CHARPOS (*it) >= newpos)
it->prev_stop = newpos;
}
else
{
@ -7886,7 +7928,9 @@ move_it_in_display_line_to (struct it *it,
((op & MOVE_TO_POS) != 0 \
&& BUFFERP (it->object) \
&& (IT_CHARPOS (*it) == to_charpos \
|| (!it->bidi_p && IT_CHARPOS (*it) > to_charpos) \
|| ((!it->bidi_p \
|| BIDI_AT_BASE_LEVEL (it->bidi_it)) \
&& IT_CHARPOS (*it) > to_charpos) \
|| (it->what == IT_COMPOSITION \
&& ((IT_CHARPOS (*it) > to_charpos \
&& to_charpos >= it->cmp_it.charpos) \
@ -7918,7 +7962,13 @@ move_it_in_display_line_to (struct it *it,
if ((op & MOVE_TO_POS) != 0
&& BUFFERP (it->object)
&& it->method == GET_FROM_BUFFER
&& ((!it->bidi_p && IT_CHARPOS (*it) > to_charpos)
&& (((!it->bidi_p
/* When the iterator is at base embedding level, we
are guaranteed that characters are delivered for
display in strictly increasing order of their
buffer positions. */
|| BIDI_AT_BASE_LEVEL (it->bidi_it))
&& IT_CHARPOS (*it) > to_charpos)
|| (it->bidi_p
&& (prev_method == GET_FROM_IMAGE
|| prev_method == GET_FROM_STRETCH

View file

@ -1,3 +1,8 @@
2011-09-27 Ulf Jasper <ulf.jasper@web.de>
* automated/newsticker-tests.el: Move newsticker-testsuite.el
to automated/newsticker-tests.el. Convert to ERT.
2011-07-26 Ulf Jasper <ulf.jasper@web.de>
* automated/icalendar-tests.el (icalendar-tests--compare-strings):

View file

@ -3,12 +3,7 @@
;; Copyright (C) 2003-2011 Free Software Foundation, Inc.
;; Author: Ulf Jasper <ulf.jasper@web.de>
;; Filename: newsticker-testsuite.el
;; URL: http://www.nongnu.org/newsticker
;; Keywords: News, RSS, Atom
;; Time-stamp: "14. Juni 2008, 12:09:39 (ulf)"
;; ======================================================================
;; This file is part of GNU Emacs.
@ -25,42 +20,26 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;; ======================================================================
;;; Commentary:
;;; Code:
(require 'cl) ; assert
;; ======================================================================
;; Entry point
;; ======================================================================
(defun newsticker--testsuite ()
"Unit test for newsticker.
Subtests signal errors if something goes wrong."
(interactive)
(newsticker--test--guid)
(newsticker--test--cache-contains)
(newsticker--test--decode-iso8601-date)
(newsticker--test--decode-rfc822-date)
(newsticker--test--group-manage-orphan-feeds)
(message "All tests passed successfully."))
(require 'ert)
(require 'newsticker)
;; ======================================================================
;; Tests for newsticker-backend
;; ======================================================================
(defun newsticker--test--guid ()
"Test `newsticker-guid-*'.
(ert-deftest newsticker--guid ()
"Test for `newsticker--guid-*'.
Signals an error if something goes wrong."
(assert (string= "blah" (newsticker--guid-to-string "blah")))
(assert (string= "myguid" (newsticker--guid '("title1" "description1" "link1"
(should (string= "blah" (newsticker--guid-to-string "blah")))
(should (string= "myguid" (newsticker--guid '("title1" "description1" "link1"
nil 'new 42 nil nil
((guid () "myguid")))))))
(defun newsticker--test--cache-contains ()
"Test `newsticker--test--cache-contains'.
Signals an error if something goes wrong."
(ert-deftest newsticker--cache-contains ()
"Test for `newsticker--cache-contains'."
(let ((newsticker--cache '((feed1
("title1" "description1" "link1" nil 'new 42
nil nil ((guid () "myguid")))))))
@ -68,78 +47,68 @@ Signals an error if something goes wrong."
(assoc 'guid (newsticker--extra '("title1" "description1"
"link1" nil 'new 42 nil nil
((guid "myguid"))))))
(assert (newsticker--cache-contains newsticker--cache 'feed1 "WRONGTITLE"
(should (newsticker--cache-contains newsticker--cache 'feed1 "WRONGTITLE"
"description1" "link1" 'new "myguid"))
(assert (not (newsticker--cache-contains newsticker--cache 'feed1 "title1"
(should (not (newsticker--cache-contains newsticker--cache 'feed1 "title1"
"description1" "link1" 'new
"WRONG GUID")))
(assert (newsticker--cache-contains newsticker--cache 'feed1 "title1"
(should (newsticker--cache-contains newsticker--cache 'feed1 "title1"
"description1" "link1" 'new "myguid")))
(let ((newsticker--cache '((feed1
("title1" "description1" "link1" nil 'new 42
nil nil ((guid () "myguid1")))
("title1" "description1" "link1" nil 'new 42
nil nil ((guid () "myguid2")))))))
(assert (not (newsticker--cache-contains newsticker--cache 'feed1 "title1"
(should (not (newsticker--cache-contains newsticker--cache 'feed1 "title1"
"description1" "link1" 'new
"myguid")))
(assert (string= "myguid1"
(should (string= "myguid1"
(newsticker--guid (newsticker--cache-contains
newsticker--cache 'feed1 "title1"
"description1" "link1" 'new
"myguid1"))))
(assert (string= "myguid2"
(should (string= "myguid2"
(newsticker--guid (newsticker--cache-contains
newsticker--cache 'feed1 "title1"
"description1" "link1" 'new
"myguid2"))))))
(defun newsticker--do-test--decode-iso8601-date (input expected)
(defun newsticker-tests--decode-iso8601-date (input expected)
"Actually test `newsticker--decode-iso8601-date'.
Signals an error if iso8601-encoded INPUT does not match EXPECTED."
Apply to INPUT and compare with EXPECTED."
(let ((result (format-time-string "%Y-%m-%dT%H:%M:%S"
(newsticker--decode-iso8601-date input)
t)))
(assert (string= result expected)
nil "Error decoding '%s': found '%s' but expected '%s'."
input result expected)))
(should (string= result expected))))
(defun newsticker--test--decode-iso8601-date ()
(ert-deftest newsticker--decode-iso8601-date ()
"Test `newsticker--decode-iso8601-date'."
(newsticker--decode-iso8601-date "2004-09-17T05:09:49+00:00")
(newsticker--decode-iso8601-date "2004-09-17T05:09+00:00")
(newsticker--decode-iso8601-date "2004-09-17T05:09:49")
(newsticker--decode-iso8601-date "2004-09-17T05:09")
(newsticker--decode-iso8601-date "2004-09-17")
(newsticker--decode-iso8601-date "2004-09")
(newsticker--do-test--decode-iso8601-date "2004"
"2004-01-01T00:00:00")
(newsticker--do-test--decode-iso8601-date "2004-09"
"2004-09-01T00:00:00")
(newsticker--do-test--decode-iso8601-date "2004-09-17"
"2004-09-17T00:00:00")
(newsticker--do-test--decode-iso8601-date "2004-09-17T05:09"
"2004-09-17T05:09:00")
(newsticker--do-test--decode-iso8601-date "2004-09-17T05:09:49"
"2004-09-17T05:09:49")
(newsticker--do-test--decode-iso8601-date "2004-09-17T05:09:49.123"
"2004-09-17T05:09:49")
(newsticker--do-test--decode-iso8601-date "2004-09-17T05:09+01:00"
"2004-09-17T04:09:00")
(newsticker--do-test--decode-iso8601-date "2004-09-17T05:09-02:00"
"2004-09-17T07:09:00"))
(newsticker-tests--decode-iso8601-date "2004"
"2004-01-01T00:00:00")
(newsticker-tests--decode-iso8601-date "2004-09"
"2004-09-01T00:00:00")
(newsticker-tests--decode-iso8601-date "2004-09-17"
"2004-09-17T00:00:00")
(newsticker-tests--decode-iso8601-date "2004-09-17T05:09"
"2004-09-17T05:09:00")
(newsticker-tests--decode-iso8601-date "2004-09-17T05:09:49"
"2004-09-17T05:09:49")
(newsticker-tests--decode-iso8601-date "2004-09-17T05:09:49.123"
"2004-09-17T05:09:49")
(newsticker-tests--decode-iso8601-date "2004-09-17T05:09+01:00"
"2004-09-17T04:09:00")
(newsticker-tests--decode-iso8601-date "2004-09-17T05:09-02:00"
"2004-09-17T07:09:00"))
(defun newsticker--do-test--decode-rfc822-date (input expected)
"Actually test `newsticker--decode-rfc822-date'.
Signals an error if rfc822-encoded INPUT does not match EXPECTED."
Apply to INPUT and compare with EXPECTED."
(let ((result (format-time-string "%Y-%m-%dT%H:%M:%S"
(newsticker--decode-rfc822-date input)
t)))
(assert (string= result expected)
nil "Error decoding '%s': found '%s' but expected '%s'."
input result expected)))
(should (string= result expected))))
(defun newsticker--test--decode-rfc822-date ()
(ert-deftest newsticker--decode-rfc822-date ()
"Test `newsticker--decode-rfc822-date'."
(newsticker--do-test--decode-rfc822-date "Mon, 10 Mar 2008 19:27:52 +0100"
"2008-03-10T18:27:52")
@ -164,16 +133,16 @@ Signals an error if rfc822-encoded INPUT does not match EXPECTED."
;; ======================================================================
;; Tests for newsticker-treeview
;; ======================================================================
(defun newsticker--test--group-manage-orphan-feeds ()
(ert-deftest newsticker--group-manage-orphan-feeds ()
"Test `newsticker--group-manage-orphan-feeds'.
Signals an error if something goes wrong."
(let ((newsticker-groups '("Feeds"))
(newsticker-url-list-defaults nil)
(newsticker-url-list '(("feed1") ("feed2") ("feed3"))))
(newsticker--group-manage-orphan-feeds)
(assert (equal '("Feeds" "feed3" "feed2" "feed1")
(should (equal '("Feeds" "feed3" "feed2" "feed1")
newsticker-groups))))
(provide 'newsticker-testsuite)
(provide 'newsticker-tests)
;;; newsticker-testsuite.el ends here
;;; newsticker-tests.el ends here