From: Magnus H. <leg...@us...> - 2008-05-15 23:36:34
|
Update of /cvsroot/emacs-jabber/emacs-jabber/tests In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv16771/tests Modified Files: Makefile.am Added Files: history.el Log Message: Revision: ma...@fr...--2005/emacs-jabber--cvs-head--0--patch-495 Creator: Magnus Henoch <ma...@fr...> Don't lose messages when unable to write them to history file --- NEW FILE: history.el --- ;; Tests for history (require 'jabber-history) ;; 1. Smoke test (let ((jabber-use-global-history t) (jabber-global-history-filename (make-temp-file "history-test")) ;; Jabber's birthday :) (our-time (encode-time 0 0 0 4 1 1999 0))) (unwind-protect (progn (jabber-history-log-message "in" "ro...@mo.../Balcony" nil "hi" our-time) (with-temp-buffer (insert-file-literally jabber-global-history-filename) (let ((expected "\\[\"\\([^\"]+\\)\" \"in\" \"ro...@mo.../Balcony\" \"me\" \"hi\"]\n") (actual (buffer-string))) (unless (string-match expected actual) (error "Testcase 1 failed; %S doesn't match %S" actual expected)) ;; The timestamps don't match for some reason... ;; (let ((timestamp (match-string 1 actual))) ;; (unless (equal (jabber-parse-time timestamp) our-time) ;; (error "Testcase 1 failed; timestamp %S didn't match %S (%S vs %S)" timestamp (jabber-encode-time our-time) (jabber-parse-time timestamp) our-time))) ))) (delete-file jabber-global-history-filename))) ;; 2. Test with unwritable history file - should not signal an error ;; This should reflect out-of-disk condition too. (let ((jabber-use-global-history t) (jabber-global-history-filename (make-temp-file "history-test"))) (set-file-modes jabber-global-history-filename #o444) (unwind-protect (progn (jabber-history-log-message "in" "ro...@mo.../Balcony" nil "hi" nil) (message "Please ignore the preceding \"Unable to write history\" error message.") ;; No error signalled - we're done. ) (delete-file jabber-global-history-filename))) ;; arch-tag: 43dd7ffe-22d7-11dd-9a7c-000a95c2fcd0 Index: Makefile.am =================================================================== RCS file: /cvsroot/emacs-jabber/emacs-jabber/tests/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 20 Apr 2008 06:21:43 -0000 1.1 +++ Makefile.am 15 May 2008 23:36:28 -0000 1.2 @@ -1,3 +1,3 @@ TESTS_ENVIRONMENT = $(EMACS) -batch -L $(top_builddir) -l -TESTS = skip-tag-forward.el +TESTS = skip-tag-forward.el history.el dist_noinst_DATA = $(TESTS) |