diff options
| author | Xue Fuqiao | 2013-08-04 10:59:08 +0800 |
|---|---|---|
| committer | Xue Fuqiao | 2013-08-04 10:59:08 +0800 |
| commit | 99191b89ff64172740add88e67f163619a07830c (patch) | |
| tree | 828d1ac7c917076703b9d4a3746ff7480bd97f0d /test | |
| parent | ab419665caa6e2ad7465cf59ef902cc4ad1d2117 (diff) | |
| parent | 2ad0a067728ccc7f8b32b0c3db1677ca351943fe (diff) | |
| download | emacs-99191b89ff64172740add88e67f163619a07830c.tar.gz emacs-99191b89ff64172740add88e67f163619a07830c.zip | |
Merge from mainline.
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 27 | ||||
| -rw-r--r-- | test/automated/core-elisp-tests.el | 40 | ||||
| -rw-r--r-- | test/automated/file-notify-tests.el | 14 | ||||
| -rw-r--r-- | test/automated/icalendar-tests.el | 76 | ||||
| -rw-r--r-- | test/automated/undo-tests.el | 4 |
5 files changed, 123 insertions, 38 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index bffe85e6a7a..f3d14786bd9 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,30 @@ | |||
| 1 | 2013-08-04 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * automated/icalendar-tests.el (icalendar-tests--test-export) | ||
| 4 | (icalendar-tests--test-import): Try more precise TZ specification. | ||
| 5 | |||
| 6 | 2013-08-03 Glenn Morris <rgm@gnu.org> | ||
| 7 | |||
| 8 | * automated/core-elisp-tests.el (core-elisp-tests): Fix defcustom. | ||
| 9 | |||
| 10 | * automated/icalendar-tests.el (icalendar-tests--test-export) | ||
| 11 | (icalendar-tests--test-import): | ||
| 12 | Use getenv/setenv rather than set-time-zone-rule. Add debug messages. | ||
| 13 | (icalendar-tests--test-import): Reset zone even if error occurred. | ||
| 14 | |||
| 15 | 2013-08-02 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 16 | |||
| 17 | * automated/core-elisp-tests.el: New file. | ||
| 18 | |||
| 19 | 2013-08-01 Glenn Morris <rgm@gnu.org> | ||
| 20 | |||
| 21 | * automated/file-notify-tests.el (file-notify--test-remote-enabled): | ||
| 22 | Try to check that the remote system has a notification program. | ||
| 23 | |||
| 24 | 2013-07-31 Glenn Morris <rgm@gnu.org> | ||
| 25 | |||
| 26 | * automated/undo-tests.el (undo-test2, undo-test5): Be quieter. | ||
| 27 | |||
| 1 | 2013-07-24 Michael Albinus <michael.albinus@gmx.de> | 28 | 2013-07-24 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 29 | ||
| 3 | * automated/file-notify-tests.el | 30 | * automated/file-notify-tests.el |
diff --git a/test/automated/core-elisp-tests.el b/test/automated/core-elisp-tests.el new file mode 100644 index 00000000000..40169b836d5 --- /dev/null +++ b/test/automated/core-elisp-tests.el | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | ;;; core-elisp-tests.el --- Testing some core Elisp rules | ||
| 2 | |||
| 3 | ;; Copyright (C) 2013 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 6 | ;; Keywords: | ||
| 7 | |||
| 8 | ;; This program is free software; you can redistribute it and/or modify | ||
| 9 | ;; it under the terms of the GNU General Public License as published by | ||
| 10 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 11 | ;; (at your option) any later version. | ||
| 12 | |||
| 13 | ;; This program is distributed in the hope that it will be useful, | ||
| 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | ;; GNU General Public License for more details. | ||
| 17 | |||
| 18 | ;; You should have received a copy of the GNU General Public License | ||
| 19 | ;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | |||
| 21 | ;;; Commentary: | ||
| 22 | |||
| 23 | ;; | ||
| 24 | |||
| 25 | ;;; Code: | ||
| 26 | |||
| 27 | (ert-deftest core-elisp-tests () | ||
| 28 | "Test some core Elisp rules." | ||
| 29 | (with-temp-buffer | ||
| 30 | ;; Check that when defvar is run within a let-binding, the toplevel default | ||
| 31 | ;; is properly initialized. | ||
| 32 | (should (equal (list (let ((c-e-x 1)) (defvar c-e-x 2) c-e-x) c-e-x) | ||
| 33 | '(1 2))) | ||
| 34 | (should (equal (list (let ((c-e-x 1)) | ||
| 35 | (defcustom c-e-x 2 "doc" :group 'blah) c-e-x) | ||
| 36 | c-e-x) | ||
| 37 | '(1 2))))) | ||
| 38 | |||
| 39 | (provide 'core-elisp-tests) | ||
| 40 | ;;; core-elisp-tests.el ends here | ||
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index 8bd4f258b1c..9f552ee7ab1 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | (defvar file-notify--test-event nil) | 43 | (defvar file-notify--test-event nil) |
| 44 | 44 | ||
| 45 | (require 'tramp) | 45 | (require 'tramp) |
| 46 | (require 'tramp-sh) | ||
| 46 | (setq tramp-verbose 0 | 47 | (setq tramp-verbose 0 |
| 47 | tramp-message-show-message nil) | 48 | tramp-message-show-message nil) |
| 48 | (when noninteractive (defalias 'tramp-read-passwd 'ignore)) | 49 | (when noninteractive (defalias 'tramp-read-passwd 'ignore)) |
| @@ -57,7 +58,18 @@ | |||
| 57 | (ignore-errors | 58 | (ignore-errors |
| 58 | (and (file-remote-p file-notify-test-remote-temporary-file-directory) | 59 | (and (file-remote-p file-notify-test-remote-temporary-file-directory) |
| 59 | (file-directory-p file-notify-test-remote-temporary-file-directory) | 60 | (file-directory-p file-notify-test-remote-temporary-file-directory) |
| 60 | (file-writable-p file-notify-test-remote-temporary-file-directory)))) | 61 | (file-writable-p file-notify-test-remote-temporary-file-directory) |
| 62 | ;; Extracted from tramp-sh-handle-file-notify-add-watch. | ||
| 63 | ;; Even though the "remote" system is just ssh@localhost, | ||
| 64 | ;; the PATH might not be the same as the "local" PATH. | ||
| 65 | ;; Eg this seems to be the case on hydra.nixos.org. | ||
| 66 | ;; Without this, tests fail with: | ||
| 67 | ;; "No file notification program found on /ssh:localhost:" | ||
| 68 | ;; Try to fix PATH instead? | ||
| 69 | (with-parsed-tramp-file-name | ||
| 70 | file-notify-test-remote-temporary-file-directory nil | ||
| 71 | (or (tramp-get-remote-gvfs-monitor-dir v) | ||
| 72 | (tramp-get-remote-inotifywait v)))))) | ||
| 61 | 73 | ||
| 62 | (defmacro file-notify--deftest-remote (test docstring) | 74 | (defmacro file-notify--deftest-remote (test docstring) |
| 63 | "Define ert `TEST-remote' for remote files." | 75 | "Define ert `TEST-remote' for remote files." |
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el index 28fa47630a8..227855681e8 100644 --- a/test/automated/icalendar-tests.el +++ b/test/automated/icalendar-tests.el | |||
| @@ -428,12 +428,14 @@ Argument EXPECTED-OUTPUT expected iCalendar result string. | |||
| 428 | 428 | ||
| 429 | European style input data must use german month names. American | 429 | European style input data must use german month names. American |
| 430 | and ISO style input data must use english month names." | 430 | and ISO style input data must use english month names." |
| 431 | (let ((tz (cadr (current-time-zone))) | 431 | (let ((tz (getenv "TZ")) |
| 432 | (calendar-date-style 'iso) | 432 | (calendar-date-style 'iso) |
| 433 | (icalendar-recurring-start-year 2000)) | 433 | (icalendar-recurring-start-year 2000)) |
| 434 | (unwind-protect | 434 | (unwind-protect |
| 435 | (progn | 435 | (progn |
| 436 | (set-time-zone-rule "CET") | 436 | (message "Current time zone: %s" (current-time-zone)) |
| 437 | (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") | ||
| 438 | (message "Current time zone: %s" (current-time-zone)) | ||
| 437 | (when input-iso | 439 | (when input-iso |
| 438 | (let ((calendar-month-name-array | 440 | (let ((calendar-month-name-array |
| 439 | ["January" "February" "March" "April" "May" "June" "July" "August" | 441 | ["January" "February" "March" "April" "May" "June" "July" "August" |
| @@ -461,8 +463,8 @@ and ISO style input data must use english month names." | |||
| 461 | "Saturday"])) | 463 | "Saturday"])) |
| 462 | (setq calendar-date-style 'american) | 464 | (setq calendar-date-style 'american) |
| 463 | (icalendar-tests--do-test-export input-american expected-output)))) | 465 | (icalendar-tests--do-test-export input-american expected-output)))) |
| 464 | ;; restore time-zone if something went terribly wrong | 466 | ;; restore time-zone even if something went terribly wrong |
| 465 | (set-time-zone-rule tz)))) | 467 | (setenv "TZ" tz)))) |
| 466 | 468 | ||
| 467 | (defun icalendar-tests--do-test-export (input expected-output) | 469 | (defun icalendar-tests--do-test-export (input expected-output) |
| 468 | "Actually perform export test. | 470 | "Actually perform export test. |
| @@ -671,37 +673,41 @@ Argument INPUT icalendar event string. | |||
| 671 | Argument EXPECTED-ISO expected iso style diary string. | 673 | Argument EXPECTED-ISO expected iso style diary string. |
| 672 | Argument EXPECTED-EUROPEAN expected european style diary string. | 674 | Argument EXPECTED-EUROPEAN expected european style diary string. |
| 673 | Argument EXPECTED-AMERICAN expected american style diary string." | 675 | Argument EXPECTED-AMERICAN expected american style diary string." |
| 674 | (let ((timezone (cadr (current-time-zone)))) | 676 | (let ((timezone (getenv "TZ"))) |
| 675 | (set-time-zone-rule "CET") | 677 | (unwind-protect |
| 676 | (with-temp-buffer | 678 | (progn |
| 677 | (if (string-match "^BEGIN:VCALENDAR" input) | 679 | (message "Current time zone: %s" (current-time-zone)) |
| 678 | (insert input) | 680 | (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3") |
| 679 | (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n") | 681 | (message "Current time zone: %s" (current-time-zone)) |
| 680 | (insert "VERSION:2.0\nBEGIN:VEVENT\n") | 682 | (with-temp-buffer |
| 681 | (insert input) | 683 | (if (string-match "^BEGIN:VCALENDAR" input) |
| 682 | (unless (eq (char-before) ?\n) | 684 | (insert input) |
| 683 | (insert "\n")) | 685 | (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n") |
| 684 | (insert "END:VEVENT\nEND:VCALENDAR\n")) | 686 | (insert "VERSION:2.0\nBEGIN:VEVENT\n") |
| 685 | (let ((icalendar-import-format "%s%d%l%o%t%u%c%U") | 687 | (insert input) |
| 686 | (icalendar-import-format-summary "%s") | 688 | (unless (eq (char-before) ?\n) |
| 687 | (icalendar-import-format-location "\n Location: %s") | 689 | (insert "\n")) |
| 688 | (icalendar-import-format-description "\n Desc: %s") | 690 | (insert "END:VEVENT\nEND:VCALENDAR\n")) |
| 689 | (icalendar-import-format-organizer "\n Organizer: %s") | 691 | (let ((icalendar-import-format "%s%d%l%o%t%u%c%U") |
| 690 | (icalendar-import-format-status "\n Status: %s") | 692 | (icalendar-import-format-summary "%s") |
| 691 | (icalendar-import-format-url "\n URL: %s") | 693 | (icalendar-import-format-location "\n Location: %s") |
| 692 | (icalendar-import-format-class "\n Class: %s") | 694 | (icalendar-import-format-description "\n Desc: %s") |
| 693 | (icalendar-import-format-uid "\n UID: %s") | 695 | (icalendar-import-format-organizer "\n Organizer: %s") |
| 694 | calendar-date-style) | 696 | (icalendar-import-format-status "\n Status: %s") |
| 695 | (when expected-iso | 697 | (icalendar-import-format-url "\n URL: %s") |
| 696 | (setq calendar-date-style 'iso) | 698 | (icalendar-import-format-class "\n Class: %s") |
| 697 | (icalendar-tests--do-test-import input expected-iso)) | 699 | (icalendar-import-format-uid "\n UID: %s") |
| 698 | (when expected-european | 700 | calendar-date-style) |
| 699 | (setq calendar-date-style 'european) | 701 | (when expected-iso |
| 700 | (icalendar-tests--do-test-import input expected-european)) | 702 | (setq calendar-date-style 'iso) |
| 701 | (when expected-american | 703 | (icalendar-tests--do-test-import input expected-iso)) |
| 702 | (setq calendar-date-style 'american) | 704 | (when expected-european |
| 703 | (icalendar-tests--do-test-import input expected-american)))) | 705 | (setq calendar-date-style 'european) |
| 704 | (set-time-zone-rule timezone))) | 706 | (icalendar-tests--do-test-import input expected-european)) |
| 707 | (when expected-american | ||
| 708 | (setq calendar-date-style 'american) | ||
| 709 | (icalendar-tests--do-test-import input expected-american))))) | ||
| 710 | (setenv "TZ" timezone)))) | ||
| 705 | 711 | ||
| 706 | (defun icalendar-tests--do-test-import (input expected-output) | 712 | (defun icalendar-tests--do-test-import (input expected-output) |
| 707 | "Actually perform import test. | 713 | "Actually perform import test. |
diff --git a/test/automated/undo-tests.el b/test/automated/undo-tests.el index 87c55c5d374..7b6989a5ef0 100644 --- a/test/automated/undo-tests.el +++ b/test/automated/undo-tests.el | |||
| @@ -124,7 +124,7 @@ | |||
| 124 | (undo-boundary) | 124 | (undo-boundary) |
| 125 | (insert " Zero") | 125 | (insert " Zero") |
| 126 | (undo-boundary) | 126 | (undo-boundary) |
| 127 | (push-mark) | 127 | (push-mark nil t) |
| 128 | (delete-region (save-excursion | 128 | (delete-region (save-excursion |
| 129 | (forward-word -1) | 129 | (forward-word -1) |
| 130 | (point)) (point)) | 130 | (point)) (point)) |
| @@ -172,7 +172,7 @@ | |||
| 172 | (insert " BEE") | 172 | (insert " BEE") |
| 173 | (undo-boundary) | 173 | (undo-boundary) |
| 174 | (setq buffer-undo-list (cons '(0.0 bogus) buffer-undo-list)) | 174 | (setq buffer-undo-list (cons '(0.0 bogus) buffer-undo-list)) |
| 175 | (push-mark) | 175 | (push-mark nil t) |
| 176 | (delete-region (save-excursion | 176 | (delete-region (save-excursion |
| 177 | (forward-word -1) | 177 | (forward-word -1) |
| 178 | (point)) (point)) | 178 | (point)) (point)) |