aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog54
-rw-r--r--test/automated/advice-tests.el17
-rw-r--r--test/automated/core-elisp-tests.el40
-rw-r--r--test/automated/data/decompress/foo-gzippedbin0 -> 30 bytes
-rw-r--r--test/automated/ert-tests.el22
-rw-r--r--test/automated/file-notify-tests.el14
-rw-r--r--test/automated/icalendar-tests.el80
-rw-r--r--test/automated/mule-util.el84
-rwxr-xr-xtest/automated/package-test.el38
-rw-r--r--test/automated/python-tests.el52
-rw-r--r--test/automated/undo-tests.el4
-rw-r--r--test/automated/zlib-tests.el40
12 files changed, 359 insertions, 86 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index bffe85e6a7a..5f3006ec7bf 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,57 @@
12013-08-14 Daniel Hackney <dan@haxney.org>
2
3 * package-test.el: Remove tar-package-building functions. Tar file
4 used for testing is included in the repository.
5 (package-test-install-texinfo, package-test-cleanup-built-files):
6 Remove.
7
82013-08-13 Fabián Ezequiel Gallina <fgallina@gnu.org>
9
10 * automated/python-tests.el (python-imenu-create-index-4)
11 (python-imenu-create-flat-index-2): New tests.
12
132013-08-05 Glenn Morris <rgm@gnu.org>
14
15 * automated/mule-util.el: New file, with tests extracted from
16 lisp/international/mule-util.el.
17
182013-08-04 Stefan Monnier <monnier@iro.umontreal.ca>
19
20 * automated/advice-tests.el (advice-tests-nadvice): Test removal
21 before definition.
22 (advice-tests-macroaliases): New test.
23
242013-08-04 Glenn Morris <rgm@gnu.org>
25
26 * automated/ert-tests.el: Disable failing test that no-one seems
27 to know how to fix. (Bug#13064)
28
29 * automated/icalendar-tests.el (icalendar-tests--test-export)
30 (icalendar-tests--test-import): Try more precise TZ specification.
31 Remove debug messages.
32
332013-08-03 Glenn Morris <rgm@gnu.org>
34
35 * automated/core-elisp-tests.el (core-elisp-tests): Fix defcustom.
36
37 * automated/icalendar-tests.el (icalendar-tests--test-export)
38 (icalendar-tests--test-import):
39 Use getenv/setenv rather than set-time-zone-rule. Add debug messages.
40 (icalendar-tests--test-import): Reset zone even if error occurred.
41
422013-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
43
44 * automated/core-elisp-tests.el: New file.
45
462013-08-01 Glenn Morris <rgm@gnu.org>
47
48 * automated/file-notify-tests.el (file-notify--test-remote-enabled):
49 Try to check that the remote system has a notification program.
50
512013-07-31 Glenn Morris <rgm@gnu.org>
52
53 * automated/undo-tests.el (undo-test2, undo-test5): Be quieter.
54
12013-07-24 Michael Albinus <michael.albinus@gmx.de> 552013-07-24 Michael Albinus <michael.albinus@gmx.de>
2 56
3 * automated/file-notify-tests.el 57 * automated/file-notify-tests.el
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el
index 69c15e34ed0..424f447ae4b 100644
--- a/test/automated/advice-tests.el
+++ b/test/automated/advice-tests.el
@@ -25,7 +25,12 @@
25 25
26(ert-deftest advice-tests-nadvice () 26(ert-deftest advice-tests-nadvice ()
27 "Test nadvice code." 27 "Test nadvice code."
28 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5)))
29 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 2)))
30 (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 5)))
28 (defun sm-test1 (x) (+ x 4)) 31 (defun sm-test1 (x) (+ x 4))
32 (should (equal (sm-test1 6) 20))
33 (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 2)))
29 (should (equal (sm-test1 6) 10)) 34 (should (equal (sm-test1 6) 10))
30 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5))) 35 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5)))
31 (should (equal (sm-test1 6) 50)) 36 (should (equal (sm-test1 6) 50))
@@ -42,6 +47,18 @@
42 (defmacro sm-test3 (x) `(call-test3 ,x)) 47 (defmacro sm-test3 (x) `(call-test3 ,x))
43 (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56))))) 48 (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56)))))
44 49
50(ert-deftest advice-tests-macroaliases ()
51 "Test nadvice code on aliases to macros."
52 (defmacro sm-test1 (a) `(list ',a))
53 (defalias 'sm-test1-alias 'sm-test1)
54 (should (equal (macroexpand '(sm-test1-alias 5)) '(list '5)))
55 (advice-add 'sm-test1-alias :around
56 (lambda (f &rest args) `(cons 1 ,(apply f args))))
57 (should (equal (macroexpand '(sm-test1-alias 5)) '(cons 1 (list '5))))
58 (defmacro sm-test1 (a) `(list 0 ',a))
59 (should (equal (macroexpand '(sm-test1-alias 5)) '(cons 1 (list 0 '5)))))
60
61
45(ert-deftest advice-tests-advice () 62(ert-deftest advice-tests-advice ()
46 "Test advice code." 63 "Test advice code."
47 (defun sm-test2 (x) (+ x 4)) 64 (defun sm-test2 (x) (+ x 4))
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/data/decompress/foo-gzipped b/test/automated/data/decompress/foo-gzipped
new file mode 100644
index 00000000000..a68653fcbb9
--- /dev/null
+++ b/test/automated/data/decompress/foo-gzipped
Binary files differ
diff --git a/test/automated/ert-tests.el b/test/automated/ert-tests.el
index 36864377ec9..a2be534c25c 100644
--- a/test/automated/ert-tests.el
+++ b/test/automated/ert-tests.el
@@ -353,16 +353,18 @@ This macro is used to test if macroexpansion in `should' works."
353 (should-error (macroexpand '(ert-deftest ghi () 353 (should-error (macroexpand '(ert-deftest ghi ()
354 :documentation "foo")))) 354 :documentation "foo"))))
355 355
356(ert-deftest ert-test-record-backtrace () 356;; FIXME Test disabled due to persistent failure owing to lexical binding.
357 (let ((test (make-ert-test :body (lambda () (ert-fail "foo"))))) 357;; http://debbugs.gnu.org/13064
358 (let ((result (ert-run-test test))) 358;;; (ert-deftest ert-test-record-backtrace ()
359 (should (ert-test-failed-p result)) 359;;; (let ((test (make-ert-test :body (lambda () (ert-fail "foo")))))
360 (with-temp-buffer 360;;; (let ((result (ert-run-test test)))
361 (ert--print-backtrace (ert-test-failed-backtrace result)) 361;;; (should (ert-test-failed-p result))
362 (goto-char (point-min)) 362;;; (with-temp-buffer
363 (end-of-line) 363;;; (ert--print-backtrace (ert-test-failed-backtrace result))
364 (let ((first-line (buffer-substring-no-properties (point-min) (point)))) 364;;; (goto-char (point-min))
365 (should (equal first-line " signal(ert-test-failed (\"foo\"))"))))))) 365;;; (end-of-line)
366;;; (let ((first-line (buffer-substring-no-properties (point-min) (point))))
367;;; (should (equal first-line " signal(ert-test-failed (\"foo\"))")))))))
366 368
367(ert-deftest ert-test-messages () 369(ert-deftest ert-test-messages ()
368 :tags '(:causes-redisplay) 370 :tags '(:causes-redisplay)
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..f83052f5ea1 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-tests.el
@@ -428,12 +428,16 @@ Argument EXPECTED-OUTPUT expected iCalendar result string.
428 428
429European style input data must use german month names. American 429European style input data must use german month names. American
430and ISO style input data must use english month names." 430and 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 ;; Use this form so as not to rely on system tz database.
438 ;; Eg hydra.nixos.org.
439 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
440;;; (message "Current time zone: %s" (current-time-zone))
437 (when input-iso 441 (when input-iso
438 (let ((calendar-month-name-array 442 (let ((calendar-month-name-array
439 ["January" "February" "March" "April" "May" "June" "July" "August" 443 ["January" "February" "March" "April" "May" "June" "July" "August"
@@ -461,8 +465,8 @@ and ISO style input data must use english month names."
461 "Saturday"])) 465 "Saturday"]))
462 (setq calendar-date-style 'american) 466 (setq calendar-date-style 'american)
463 (icalendar-tests--do-test-export input-american expected-output)))) 467 (icalendar-tests--do-test-export input-american expected-output))))
464 ;; restore time-zone if something went terribly wrong 468 ;; restore time-zone even if something went terribly wrong
465 (set-time-zone-rule tz)))) 469 (setenv "TZ" tz))))
466 470
467(defun icalendar-tests--do-test-export (input expected-output) 471(defun icalendar-tests--do-test-export (input expected-output)
468 "Actually perform export test. 472 "Actually perform export test.
@@ -671,37 +675,43 @@ Argument INPUT icalendar event string.
671Argument EXPECTED-ISO expected iso style diary string. 675Argument EXPECTED-ISO expected iso style diary string.
672Argument EXPECTED-EUROPEAN expected european style diary string. 676Argument EXPECTED-EUROPEAN expected european style diary string.
673Argument EXPECTED-AMERICAN expected american style diary string." 677Argument EXPECTED-AMERICAN expected american style diary string."
674 (let ((timezone (cadr (current-time-zone)))) 678 (let ((timezone (getenv "TZ")))
675 (set-time-zone-rule "CET") 679 (unwind-protect
676 (with-temp-buffer 680 (progn
677 (if (string-match "^BEGIN:VCALENDAR" input) 681;;; (message "Current time zone: %s" (current-time-zone))
678 (insert input) 682 ;; Use this form so as not to rely on system tz database.
679 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n") 683 ;; Eg hydra.nixos.org.
680 (insert "VERSION:2.0\nBEGIN:VEVENT\n") 684 (setenv "TZ" "CET-1CEST,M3.5.0/2,M10.5.0/3")
681 (insert input) 685;;; (message "Current time zone: %s" (current-time-zone))
682 (unless (eq (char-before) ?\n) 686 (with-temp-buffer
683 (insert "\n")) 687 (if (string-match "^BEGIN:VCALENDAR" input)
684 (insert "END:VEVENT\nEND:VCALENDAR\n")) 688 (insert input)
685 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U") 689 (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n")
686 (icalendar-import-format-summary "%s") 690 (insert "VERSION:2.0\nBEGIN:VEVENT\n")
687 (icalendar-import-format-location "\n Location: %s") 691 (insert input)
688 (icalendar-import-format-description "\n Desc: %s") 692 (unless (eq (char-before) ?\n)
689 (icalendar-import-format-organizer "\n Organizer: %s") 693 (insert "\n"))
690 (icalendar-import-format-status "\n Status: %s") 694 (insert "END:VEVENT\nEND:VCALENDAR\n"))
691 (icalendar-import-format-url "\n URL: %s") 695 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
692 (icalendar-import-format-class "\n Class: %s") 696 (icalendar-import-format-summary "%s")
693 (icalendar-import-format-uid "\n UID: %s") 697 (icalendar-import-format-location "\n Location: %s")
694 calendar-date-style) 698 (icalendar-import-format-description "\n Desc: %s")
695 (when expected-iso 699 (icalendar-import-format-organizer "\n Organizer: %s")
696 (setq calendar-date-style 'iso) 700 (icalendar-import-format-status "\n Status: %s")
697 (icalendar-tests--do-test-import input expected-iso)) 701 (icalendar-import-format-url "\n URL: %s")
698 (when expected-european 702 (icalendar-import-format-class "\n Class: %s")
699 (setq calendar-date-style 'european) 703 (icalendar-import-format-uid "\n UID: %s")
700 (icalendar-tests--do-test-import input expected-european)) 704 calendar-date-style)
701 (when expected-american 705 (when expected-iso
702 (setq calendar-date-style 'american) 706 (setq calendar-date-style 'iso)
703 (icalendar-tests--do-test-import input expected-american)))) 707 (icalendar-tests--do-test-import input expected-iso))
704 (set-time-zone-rule timezone))) 708 (when expected-european
709 (setq calendar-date-style 'european)
710 (icalendar-tests--do-test-import input expected-european))
711 (when expected-american
712 (setq calendar-date-style 'american)
713 (icalendar-tests--do-test-import input expected-american)))))
714 (setenv "TZ" timezone))))
705 715
706(defun icalendar-tests--do-test-import (input expected-output) 716(defun icalendar-tests--do-test-import (input expected-output)
707 "Actually perform import test. 717 "Actually perform import test.
diff --git a/test/automated/mule-util.el b/test/automated/mule-util.el
new file mode 100644
index 00000000000..3e269faad75
--- /dev/null
+++ b/test/automated/mule-util.el
@@ -0,0 +1,84 @@
1;;; mule-util --- tests for international/mule-util.el -*- coding: utf-8; -*-
2
3;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19
20;;; Commentary:
21
22;;; Code:
23
24(require 'ert)
25(require 'mule-util)
26
27(defconst mule-util-test-truncate-data
28 '((("" 0) . "")
29 (("x" 1) . "x")
30 (("xy" 1) . "x")
31 (("xy" 2 1) . "y")
32 (("xy" 0) . "")
33 (("xy" 3) . "xy")
34 (("中" 0) . "")
35 (("中" 1) . "")
36 (("中" 2) . "中")
37 (("中" 1 nil ? ) . " ")
38 (("中文" 3 1 ? ) . " ")
39 (("x中x" 2) . "x")
40 (("x中x" 3) . "x中")
41 (("x中x" 3) . "x中")
42 (("x中x" 4 1) . "中x")
43 (("kor한e글an" 8 1 ? ) . "or한e글")
44 (("kor한e글an" 7 2 ? ) . "r한e ")
45 (("" 0 nil nil "...") . "")
46 (("x" 3 nil nil "...") . "x")
47 (("中" 3 nil nil "...") . "中")
48 (("foo" 3 nil nil "...") . "foo")
49 (("foo" 2 nil nil "...") . "fo") ;; XEmacs failure?
50 (("foobar" 6 0 nil "...") . "foobar")
51 (("foobarbaz" 6 nil nil "...") . "foo...")
52 (("foobarbaz" 7 2 nil "...") . "ob...")
53 (("foobarbaz" 9 3 nil "...") . "barbaz")
54 (("こhんeにlちlはo" 15 1 ? t) . " hんeにlちlはo")
55 (("こhんeにlちlはo" 14 1 ? t) . " hんeにlち...")
56 (("x" 3 nil nil "粵語") . "x")
57 (("中" 2 nil nil "粵語") . "中")
58 (("中" 1 nil ?x "粵語") . "x") ;; XEmacs error
59 (("中文" 3 nil ? "粵語") . "中 ") ;; XEmacs error
60 (("foobarbaz" 4 nil nil "粵語") . "粵語")
61 (("foobarbaz" 5 nil nil "粵語") . "f粵語")
62 (("foobarbaz" 6 nil nil "粵語") . "fo粵語")
63 (("foobarbaz" 8 3 nil "粵語") . "b粵語")
64 (("こhんeにlちlはo" 14 4 ?x "日本語") . "xeに日本語")
65 (("こhんeにlちlはo" 13 4 ?x "日本語") . "xex日本語")
66 )
67 "Test data for `truncate-string-to-width'.")
68
69(defun mule-util-test-truncate-create (n)
70 "Create a test for element N of the `mule-util-test-truncate-data' constant."
71 (let ((testname (intern (format "mule-util-test-truncate-%.2d" n)))
72 (testdoc (format "Test element %d of `mule-util-test-truncate-data'."
73 n))
74 (testdata (nth n mule-util-test-truncate-data)))
75 (eval
76 `(ert-deftest ,testname ()
77 ,testdoc
78 (should (equal (apply 'truncate-string-to-width ',(car testdata))
79 ,(cdr testdata)))))))
80
81(dotimes (i (length mule-util-test-truncate-data))
82 (mule-util-test-truncate-create i))
83
84;;; mule-util.el ends here
diff --git a/test/automated/package-test.el b/test/automated/package-test.el
index a5f0ebb1f94..799009063e1 100755
--- a/test/automated/package-test.el
+++ b/test/automated/package-test.el
@@ -85,9 +85,6 @@
85 (expand-file-name "archive-contents" package-test-data-dir) 85 (expand-file-name "archive-contents" package-test-data-dir)
86 "Path to a static copy of \"archive-contents\".") 86 "Path to a static copy of \"archive-contents\".")
87 87
88(defvar package-test-built-file-suffixes '(".tar" "/dir" "/*.info")
89 "Remove these files when cleaning up a built package.")
90
91(cl-defmacro with-package-test ((&optional &key file 88(cl-defmacro with-package-test ((&optional &key file
92 basedir 89 basedir
93 install 90 install
@@ -142,33 +139,6 @@
142 (let ((help-xref-following t)) 139 (let ((help-xref-following t))
143 ,@body))) 140 ,@body)))
144 141
145(autoload 'makeinfo-buffer "makeinfo")
146(defvar compilation-in-progress)
147
148(defun package-test-install-texinfo (file)
149 "Install from texinfo FILE.
150
151FILE should be a .texinfo file relative to the current
152`default-directory'"
153 (require 'info)
154 (let* ((full-file (expand-file-name file))
155 (info-file (replace-regexp-in-string "\\.texi\\'" ".info" full-file))
156 (old-info-defn (symbol-function 'Info-revert-find-node)))
157 (require 'info)
158 (setf (symbol-function 'Info-revert-find-node) #'ignore)
159 (with-current-buffer (find-file-literally full-file)
160 (unwind-protect
161 (progn
162 (makeinfo-buffer)
163 ;; Give `makeinfo-buffer' a chance to finish
164 (while compilation-in-progress
165 (sit-for 0.1))
166 (call-process "ginstall-info" nil nil nil
167 (format "--info-dir=%s" default-directory)
168 (format "%s" info-file)))
169 (kill-buffer)
170 (setf (symbol-function 'Info-revert-find-node) old-info-defn)))))
171
172(defun package-test-strip-version (dir) 142(defun package-test-strip-version (dir)
173 (replace-regexp-in-string "-pkg\\.el\\'" "" (package--description-file dir))) 143 (replace-regexp-in-string "-pkg\\.el\\'" "" (package--description-file dir)))
174 144
@@ -178,14 +148,6 @@ FILE should be a .texinfo file relative to the current
178 '(lambda (item) (file-expand-wildcards (concat base item))) 148 '(lambda (item) (file-expand-wildcards (concat base item)))
179 suffix-list)) 149 suffix-list))
180 150
181(defun package-test-cleanup-built-files (dir)
182 "Remove files which were the result of creating a tar archive.
183
184DIR is the base name of the package directory, without the trailing slash"
185 (let* ((pkg-dirname (file-name-nondirectory dir)))
186 (dolist (file (package-test-suffix-matches dir package-test-built-file-suffixes))
187 (delete-file file))))
188
189(defvar tar-parse-info) 151(defvar tar-parse-info)
190(declare-function tar-header-name "tar-mode" (cl-x) t) ; defstruct 152(declare-function tar-header-name "tar-mode" (cl-x) t) ; defstruct
191 153
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index fdae235ad38..ef1c0155ab5 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -1792,6 +1792,34 @@ class Foo(object):
1792 (cons "foo2 (def)" (copy-marker 77))))) 1792 (cons "foo2 (def)" (copy-marker 77)))))
1793 (python-imenu-create-index))))) 1793 (python-imenu-create-index)))))
1794 1794
1795(ert-deftest python-imenu-create-index-4 ()
1796 (python-tests-with-temp-buffer
1797 "
1798class Foo(object):
1799 class Bar(object):
1800 def __init__(self):
1801 pass
1802
1803 def __str__(self):
1804 pass
1805
1806 def __init__(self):
1807 pass
1808"
1809 (goto-char (point-max))
1810 (should (equal
1811 (list
1812 (list
1813 "Foo (class)"
1814 (cons "*class definition*" (copy-marker 2))
1815 (list
1816 "Bar (class)"
1817 (cons "*class definition*" (copy-marker 21))
1818 (cons "__init__ (def)" (copy-marker 44))
1819 (cons "__str__ (def)" (copy-marker 90)))
1820 (cons "__init__ (def)" (copy-marker 135))))
1821 (python-imenu-create-index)))))
1822
1795(ert-deftest python-imenu-create-flat-index-1 () 1823(ert-deftest python-imenu-create-flat-index-1 ()
1796 (python-tests-with-temp-buffer 1824 (python-tests-with-temp-buffer
1797 " 1825 "
@@ -1851,6 +1879,30 @@ class Baz(object):
1851 (cons "Baz.Frob.c" (copy-marker 626))) 1879 (cons "Baz.Frob.c" (copy-marker 626)))
1852 (python-imenu-create-flat-index))))) 1880 (python-imenu-create-flat-index)))))
1853 1881
1882(ert-deftest python-imenu-create-flat-index-2 ()
1883 (python-tests-with-temp-buffer
1884 "
1885class Foo(object):
1886 class Bar(object):
1887 def __init__(self):
1888 pass
1889
1890 def __str__(self):
1891 pass
1892
1893 def __init__(self):
1894 pass
1895"
1896 (goto-char (point-max))
1897 (should (equal
1898 (list
1899 (cons "Foo" (copy-marker 2))
1900 (cons "Foo.Bar" (copy-marker 21))
1901 (cons "Foo.Bar.__init__" (copy-marker 44))
1902 (cons "Foo.Bar.__str__" (copy-marker 90))
1903 (cons "Foo.__init__" (copy-marker 135)))
1904 (python-imenu-create-flat-index)))))
1905
1854 1906
1855;;; Misc helpers 1907;;; Misc helpers
1856 1908
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))
diff --git a/test/automated/zlib-tests.el b/test/automated/zlib-tests.el
new file mode 100644
index 00000000000..d03d4c981b8
--- /dev/null
+++ b/test/automated/zlib-tests.el
@@ -0,0 +1,40 @@
1;;; zlib-tests.el --- Test suite for zlib.
2
3;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5;; Author: Lars Ingebrigtsen <larsi@gnus.org>
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software: you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation, either version 3 of the License, or
12;; (at your option) any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22;;; Code:
23
24(require 'ert)
25
26(ert-deftest zlib--decompress ()
27 "Test decompressing a gzipped file."
28 (when (and (fboundp 'zlib-available-p)
29 (zlib-available-p))
30 (should (string=
31 (with-temp-buffer
32 (set-buffer-multibyte nil)
33 (insert-file-contents-literally "data/decompress/foo-gzipped")
34 (zlib-decompress-region (point-min) (point-max))
35 (buffer-string))
36 "foo\n"))))
37
38(provide 'zlib-tests)
39
40;;; zlib-tests.el ends here.