aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBill Wohler2012-11-24 19:43:02 -0800
committerBill Wohler2012-11-24 19:43:02 -0800
commit5244bc019bf7376caff3bb198ff674e0ad9fb0e6 (patch)
tree02ee1615e904771f692ec2957c79a08ae029a13d /test
parent9f7e719509474e92f85955e22e57ffeebd4e96f3 (diff)
parentc07a6ded1df2f4156badc9add2953579622c3722 (diff)
downloademacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.tar.gz
emacs-5244bc019bf7376caff3bb198ff674e0ad9fb0e6.zip
Merge from trunk.
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog224
-rw-r--r--test/automated/Makefile.in6
-rw-r--r--test/automated/advice-tests.el116
-rw-r--r--test/automated/bytecomp-tests.el2
-rw-r--r--test/automated/comint-testsuite.el2
-rw-r--r--test/automated/compile-tests.el8
-rw-r--r--test/automated/ert-tests.el134
-rw-r--r--test/automated/ert-x-tests.el198
-rw-r--r--test/automated/f90.el2
-rw-r--r--test/automated/files.el149
-rw-r--r--test/automated/font-parse-tests.el2
-rw-r--r--test/automated/gnus-tests.el2
-rw-r--r--test/automated/icalendar-tests.el216
-rw-r--r--test/automated/lexbind-tests.el2
-rw-r--r--test/automated/newsticker-tests.el2
-rw-r--r--test/automated/occur-tests.el51
-rw-r--r--test/automated/ruby-mode-tests.el365
-rw-r--r--test/automated/url-future-tests.el57
-rw-r--r--test/automated/url-util-tests.el51
-rw-r--r--test/automated/vc-bzr.el29
-rw-r--r--test/automated/xml-parse-tests.el135
-rw-r--r--test/cedet/cedet-utests.el2
-rw-r--r--test/cedet/ede-tests.el2
-rw-r--r--test/cedet/semantic-ia-utest.el2
-rw-r--r--test/cedet/semantic-tests.el2
-rw-r--r--test/cedet/semantic-utest-c.el2
-rw-r--r--test/cedet/semantic-utest.el2
-rw-r--r--test/cedet/srecode-tests.el2
-rw-r--r--test/cedet/tests/test.c2
-rw-r--r--test/cedet/tests/test.el2
-rw-r--r--test/cedet/tests/test.make2
-rw-r--r--test/cedet/tests/testdoublens.cpp2
-rw-r--r--test/cedet/tests/testdoublens.hpp2
-rw-r--r--test/cedet/tests/testjavacomp.java2
-rw-r--r--test/cedet/tests/testpolymorph.cpp2
-rw-r--r--test/cedet/tests/testspp.c2
-rw-r--r--test/cedet/tests/testsppreplace.c2
-rw-r--r--test/cedet/tests/testsppreplaced.c2
-rw-r--r--test/cedet/tests/testsubclass.cpp2
-rw-r--r--test/cedet/tests/testsubclass.hh2
-rw-r--r--test/cedet/tests/testtypedefs.cpp2
-rw-r--r--test/cedet/tests/testvarnames.c9
-rw-r--r--test/eshell.el8
-rw-r--r--test/indent/latex-mode.tex11
-rwxr-xr-xtest/indent/perl.perl5
-rw-r--r--test/indent/ruby.rb27
-rwxr-xr-xtest/indent/shell.rc9
-rwxr-xr-xtest/indent/shell.sh26
-rw-r--r--test/redisplay-testsuite.el99
-rw-r--r--test/rmailmm.el2
50 files changed, 1696 insertions, 293 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index 964238ae45b..b66c2925287 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,8 +1,200 @@
12012-11-20 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * automated/advice-tests.el (advice-tests--data): Remove.
4 (advice-tests): Move the tests directly here instead.
5 Add called-interactively-p tests.
6
72012-11-19 Stefan Monnier <monnier@iro.umontreal.ca>
8
9 * automated/ert-x-tests.el: Use cl-lib.
10 * automated/ert-tests.el: Use lexical-binding and cl-lib.
11
122012-11-14 Dmitry Gutov <dgutov@yandex.ru>
13
14 * automated/ruby-mode-tests.el (ruby-indent-singleton-class): Pass.
15 (ruby-indent-inside-heredoc-after-operator)
16 (ruby-indent-inside-heredoc-after-space): New tests.
17 Change direct font-lock face references to var references.
18 (ruby-interpolation-suppresses-syntax-inside): New test.
19 (ruby-interpolation-inside-percent-literal-with-paren):
20 New failing test.
21
222012-11-13 Dmitry Gutov <dgutov@yandex.ru>
23
24 * automated/ruby-mode-tests.el (ruby-heredoc-font-lock)
25 (ruby-singleton-class-no-heredoc-font-lock)
26 (ruby-add-log-current-method-examples): New tests.
27 (ruby-test-string): Extract from ruby-should-indent-buffer.
28 (ruby-deftest-move-to-block): New macro.
29 Add several move-to-block tests.
30
312012-11-12 Stefan Monnier <monnier@iro.umontreal.ca>
32
33 * automated/advice-tests.el: New tests.
34
352012-10-14 Eli Zaretskii <eliz@gnu.org>
36
37 * automated/compile-tests.el (compile-tests--test-regexps-data):
38 Add new data for msft's new format.
39
402012-09-08 Dmitry Gutov <dgutov@yandex.ru>
41
42 * automated/ruby-mode-tests.el:
43 (ruby-toggle-block-to-multiline): New test.
44 (ruby-should-indent-buffer, ruby-toggle-block-to-do-end)
45 (ruby-toggle-block-to-brace): Use buffer-string.
46
472012-09-07 Dmitry Gutov <dgutov@yandex.ru>
48
49 * automated/ruby-mode-tests.el: New tests (Bug#11613).
50
512012-08-28 Chong Yidong <cyd@gnu.org>
52
53 * automated/files.el: Test every combination of values for
54 enable-local-variables and enable-local-eval.
55
562012-08-19 Chong Yidong <cyd@gnu.org>
57
58 * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer.
59
602012-08-18 Chong Yidong <cyd@gnu.org>
61
62 * redisplay-testsuite.el (test-redisplay-4): New test (Bug#3874).
63
642012-08-14 Dmitry Gutov <dgutov@yandex.ru>
65
66 * indent/ruby.rb: Rearrange examples, add new ones.
67
682012-08-12 Dmitry Gutov <dgutov@yandex.ru>
69
70 * automated/ruby-mode-tests.el (ruby-move-to-block-stops-at-opening)
71 (ruby-toggle-block-to-do-end, ruby-toggle-block-to-brace): New test.
72
732012-08-11 Glenn Morris <rgm@gnu.org>
74
75 * automated/files.el: New file.
76
77 * automated/Makefile.in (all): Fix typo.
78
792012-08-10 Dmitry Gutov <dgutov@yandex.ru>
80
81 * automated/ruby-mode-tests.el (ruby-should-indent):
82 Add docstring, check (current-indentation) instead of (current-column).
83 (ruby-should-indent-buffer): New function.
84 Add tests for `ruby-deep-indent-paren' behavior.
85 Port all tests from test/misc/test_ruby_mode.rb in Ruby repo.
86
872012-08-10 Nobuyoshi Nakada <nobu@ruby-lang.org>
88
89 Original tests in test_ruby_mode.rb in upstream (author).
90
912012-08-09 Dmitry Gutov <dgutov@yandex.ru>
92
93 * automated/ruby-mode-tests.el (ruby-should-indent)
94 (ruby-assert-state): New functions.
95 Add new tests.
96
972012-07-29 David Engster <deng@randomsample.de>
98
99 * automated/xml-parse-tests.el (xml-parse-tests--qnames):
100 New variable to hold test data for name expansion.
101 (xml-parse-tests): Test the two different types of name expansion.
102
1032012-07-29 Juri Linkov <juri@jurta.org>
104
105 * automated/occur-tests.el (occur-test-case): Use predefined
106 buffer name " *test-occur*" instead of a random buffer name.
107
1082012-07-20 Dmitry Gutov <dgutov@yandex.ru>
109
110 * automated/ruby-mode-tests.el: New file with one test.
111
1122012-07-17 Stefan Monnier <monnier@iro.umontreal.ca>
113
114 * indent/shell.sh: Add test case for ${#VAR}.
115
116 * indent/latex-mode.tex: New file.
117
1182012-07-11 Stefan Monnier <monnier@iro.umontreal.ca>
119
120 * eshell.el: Use cl-lib.
121
1222012-07-03 Chong Yidong <cyd@gnu.org>
123
124 * automated/xml-parse-tests.el (xml-parse-tests--bad-data): New.
125
1262012-07-02 Chong Yidong <cyd@gnu.org>
127
128 * automated/xml-parse-tests.el (xml-parse-tests--data):
129 More testcases.
130
1312012-07-01 Chong Yidong <cyd@gnu.org>
132
133 * automated/xml-parse-tests.el: New file.
134
1352012-06-27 Stefan Monnier <monnier@iro.umontreal.ca>
136
137 * automated/ert-x-tests.el (ert-test-run-tests-interactively-2):
138 Use cl-flet.
139
1402012-06-08 Ulf Jasper <ulf.jasper@web.de>
141
142 * automated/icalendar-tests.el (icalendar--parse-vtimezone):
143 Test escaped commas in TZID (Bug#11473).
144 (icalendar-import-with-timezone): New.
145 (icalendar-real-world): Add new testcase as given in the bugreport
146 of Bug#11473.
147
1482012-05-29 Ulf Jasper <ulf.jasper@web.de>
149
150 * automated/icalendar-tests.el (icalendar-tests--test-import):
151 Include UID in import tests (Bug#11525).
152 (icalendar-import-non-recurring, icalendar-import-rrule)
153 (icalendar-import-duration, icalendar-import-bug-6766): Adjust to
154 UID-import change.
155 (icalendar-import-with-uid): New.
156 (icalendar-tests--test-cycle, icalendar-tests--do-test-cycle):
157 Include UID in cycle tests.
158 (icalendar-cycle, icalendar-real-world): UID-import change.
159
1602012-05-21 Glenn Morris <rgm@gnu.org>
161
162 * automated/Makefile.in (setwins): Scrap superfluous subshell.
163
1642012-05-15 Teodor Zlatanov <tzz@lifelogs.com>
165
166 * automated/url-util-tests.el: New file to test
167 lisp/url/url-util.el. Only `url-build-query-string' and
168 `url-parse-query-string' are tested right now (Bug#8706).
169
1702012-04-28 Stefan Monnier <monnier@iro.umontreal.ca>
171
172 * indent/shell.sh:
173 * indent/shell.rc: Ad some test cases.
174
1752012-04-24 Stefan Monnier <monnier@iro.umontreal.ca>
176
177 * indent/ruby.rb: New file, to test new syntax-propertize code.
178
1792012-04-11 Glenn Morris <rgm@gnu.org>
180
181 * automated/vc-bzr.el (vc-bzr-test-faulty-bzr-autoloads): New test.
182
1832012-02-13 Teodor Zlatanov <tzz@lifelogs.com>
184
185 * automated/url-future-tests.el (url-future-tests): Move from
186 lisp/url/url-future.el and rename.
187
1882012-01-29 Ulf Jasper <ulf.jasper@web.de>
189
190 * automated/icalendar-tests.el (icalendar-import-non-recurring):
191 Fix broken test, caused by missing trailing blank.
192
12011-12-03 Chong Yidong <cyd@gnu.org> 1932011-12-03 Chong Yidong <cyd@gnu.org>
2 194
3 * automated/compile-tests.el (compile-tests--test-regexps-data): 195 * automated/compile-tests.el (compile-tests--test-regexps-data):
4 Increase column numbers by one to reflect change in how 196 Increase column numbers by one to reflect change in how
5 compilation-message is recorded (Bug#10172). 197 compilation-message is recorded (Bug#10172).
6 198
72011-11-22 Glenn Morris <rgm@gnu.org> 1992011-11-22 Glenn Morris <rgm@gnu.org>
8 200
@@ -21,7 +213,7 @@
212011-10-30 Ulf Jasper <ulf.jasper@web.de> 2132011-10-30 Ulf Jasper <ulf.jasper@web.de>
22 214
23 * automated/newsticker-tests.el 215 * automated/newsticker-tests.el
24 (newsticker--group-manage-orphan-feeds): Removed fsetting of 216 (newsticker--group-manage-orphan-feeds): Remove fsetting of
25 newsticker--treeview-tree-update. 217 newsticker--treeview-tree-update.
26 218
272011-10-29 Ulf Jasper <ulf.jasper@web.de> 2192011-10-29 Ulf Jasper <ulf.jasper@web.de>
@@ -58,7 +250,7 @@
58 (icalendar--format-ical-event) 250 (icalendar--format-ical-event)
59 (icalendar--parse-summary-and-rest) 251 (icalendar--parse-summary-and-rest)
60 (icalendar-tests--do-test-import) 252 (icalendar-tests--do-test-import)
61 (icalendar-tests--do-test-cycle) : Changed argument order of 253 (icalendar-tests--do-test-cycle): Change argument order of
62 string= to EXPECTED ACTUAL. 254 string= to EXPECTED ACTUAL.
63 (icalendar--import-format-sample) 255 (icalendar--import-format-sample)
64 (icalendar--format-ical-event) 256 (icalendar--format-ical-event)
@@ -66,7 +258,7 @@
66 (icalendar-import-rrule) 258 (icalendar-import-rrule)
67 (icalendar-import-duration) 259 (icalendar-import-duration)
68 (icalendar-import-bug-6766) 260 (icalendar-import-bug-6766)
69 (icalendar-real-world): Adjusted to string= instead of 261 (icalendar-real-world): Adjust to string= instead of
70 icalendar-tests--compare-strings. 262 icalendar-tests--compare-strings.
71 (icalendar-import-multiple-vcalendars): New. 263 (icalendar-import-multiple-vcalendars): New.
72 264
@@ -253,8 +445,8 @@
2532010-02-19 Ulf Jasper <ulf.jasper@web.de> 4452010-02-19 Ulf Jasper <ulf.jasper@web.de>
254 446
255 * icalendar-testsuite.el 447 * icalendar-testsuite.el
256 (icalendar-testsuite--run-function-tests): Added new tests. 448 (icalendar-testsuite--run-function-tests): Add new tests.
257 (icalendar-testsuite--test-diarytime-to-isotime): Added another 449 (icalendar-testsuite--test-diarytime-to-isotime): Add another
258 testcase. 450 testcase.
259 (icalendar-testsuite--test-convert-ordinary-to-ical): New. 451 (icalendar-testsuite--test-convert-ordinary-to-ical): New.
260 (icalendar-testsuite--test-convert-weekly-to-ical): New. 452 (icalendar-testsuite--test-convert-weekly-to-ical): New.
@@ -279,14 +471,14 @@
2792009-12-18 Ulf Jasper <ulf.jasper@web.de> 4712009-12-18 Ulf Jasper <ulf.jasper@web.de>
280 472
281 * icalendar-testsuite.el 473 * icalendar-testsuite.el
282 (icalendar-testsuite--run-function-tests): Added 474 (icalendar-testsuite--run-function-tests):
283 icalendar-testsuite--test-parse-vtimezone. 475 Add icalendar-testsuite--test-parse-vtimezone.
284 (icalendar-testsuite--test-parse-vtimezone): New. 476 (icalendar-testsuite--test-parse-vtimezone): New.
285 (icalendar-testsuite--do-test-cycle): Doc changes. 477 (icalendar-testsuite--do-test-cycle): Doc changes.
286 (icalendar-testsuite--run-real-world-tests): Removed trailing 478 (icalendar-testsuite--run-real-world-tests): Remove trailing
287 whitespace -- see change of icalendar--add-diary-entry in 479 whitespace -- see change of icalendar--add-diary-entry in
288 icalendar.el. 480 icalendar.el.
289 (icalendar-testsuite--run-cycle-tests): Re-enabled all tests. 481 (icalendar-testsuite--run-cycle-tests): Re-enable all tests.
290 482
2912009-09-30 Glenn Morris <rgm@gnu.org> 4832009-09-30 Glenn Morris <rgm@gnu.org>
292 484
@@ -307,12 +499,12 @@
3072009-01-25 Ulf Jasper <ulf.jasper@web.de> 4992009-01-25 Ulf Jasper <ulf.jasper@web.de>
308 500
309 * icalendar-testsuite.el 501 * icalendar-testsuite.el
310 (icalendar-testsuite--run-function-tests): Added 502 (icalendar-testsuite--run-function-tests):
311 icalendar-testsuite--test-diarytime-to-isotime. 503 Add icalendar-testsuite--test-diarytime-to-isotime.
312 (icalendar-testsuite--test-parse-summary-and-rest): Adjusted to 504 (icalendar-testsuite--test-parse-summary-and-rest): Adjust to
313 recent icalendar fixes. 505 recent icalendar fixes.
314 (icalendar-testsuite--test-diarytime-to-isotime): New. 506 (icalendar-testsuite--test-diarytime-to-isotime): New.
315 (icalendar-testsuite--test-create-uid): Adjusted to recent 507 (icalendar-testsuite--test-create-uid): Adjust to recent
316 icalendar changes. 508 icalendar changes.
317 509
3182008-11-30 Shigeru Fukaya <shigeru.fukaya@gmail.com> 5102008-11-30 Shigeru Fukaya <shigeru.fukaya@gmail.com>
@@ -322,7 +514,7 @@
3222008-10-31 Ulf Jasper <ulf.jasper@web.de> 5142008-10-31 Ulf Jasper <ulf.jasper@web.de>
323 515
324 * icalendar-testsuite.el (icalendar-testsuite--run-function-tests): 516 * icalendar-testsuite.el (icalendar-testsuite--run-function-tests):
325 Added `icalendar-testsuite--test-create-uid'. 517 Add `icalendar-testsuite--test-create-uid'.
326 (icalendar-testsuite--test-create-uid): New. 518 (icalendar-testsuite--test-create-uid): New.
327 519
3282008-06-14 Ulf Jasper <ulf.jasper@web.de> 5202008-06-14 Ulf Jasper <ulf.jasper@web.de>
@@ -365,7 +557,7 @@
365;; coding: utf-8 557;; coding: utf-8
366;; End: 558;; End:
367 559
368 Copyright (C) 2008-2011 Free Software Foundation, Inc. 560 Copyright (C) 2008-2012 Free Software Foundation, Inc.
369 561
370 This file is part of GNU Emacs. 562 This file is part of GNU Emacs.
371 563
diff --git a/test/automated/Makefile.in b/test/automated/Makefile.in
index b16c9721897..5f92e21d91a 100644
--- a/test/automated/Makefile.in
+++ b/test/automated/Makefile.in
@@ -1,5 +1,5 @@
1# Maintenance productions for the automated test directory 1# Maintenance productions for the automated test directory
2# Copyright (C) 2010-2011 Free Software Foundation, Inc. 2# Copyright (C) 2010-2012 Free Software Foundation, Inc.
3 3
4# This file is part of GNU Emacs. 4# This file is part of GNU Emacs.
5 5
@@ -48,14 +48,14 @@ BYTE_COMPILE_EXTRA_FLAGS =
48emacs = EMACSLOADPATH=$(lispsrc):$(test) LC_ALL=C $(EMACS) $(EMACSOPT) 48emacs = EMACSLOADPATH=$(lispsrc):$(test) LC_ALL=C $(EMACS) $(EMACSOPT)
49 49
50# Common command to find subdirectories 50# Common command to find subdirectories
51setwins=subdirs=`(find . -type d -print)`; \ 51setwins=subdirs=`find . -type d -print`; \
52 for file in $$subdirs; do \ 52 for file in $$subdirs; do \
53 case $$file in */.* | */.*/* | */=* ) ;; \ 53 case $$file in */.* | */.*/* | */=* ) ;; \
54 *) wins="$$wins $$file" ;; \ 54 *) wins="$$wins $$file" ;; \
55 esac; \ 55 esac; \
56 done 56 done
57 57
58all: test 58all: check
59 59
60doit: 60doit:
61 61
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el
new file mode 100644
index 00000000000..94f69e77e43
--- /dev/null
+++ b/test/automated/advice-tests.el
@@ -0,0 +1,116 @@
1;;; advice-tests.el --- Test suite for the new advice thingy.
2
3;; Copyright (C) 2012 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(ert-deftest advice-tests ()
25 "Test advice code."
26 (with-temp-buffer
27 (defun sm-test1 (x) (+ x 4))
28 (should (equal (sm-test1 6) 10))
29 (advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 5)))
30 (should (equal (sm-test1 6) 50))
31 (defun sm-test1 (x) (+ x 14))
32 (should (equal (sm-test1 6) 100))
33 (should (equal (null (get 'sm-test1 'defalias-fset-function)) nil))
34 (advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 5)))
35 (should (equal (sm-test1 6) 20))
36 (should (equal (null (get 'sm-test1 'defalias-fset-function)) t))
37
38 (defun sm-test2 (x) (+ x 4))
39 (should (equal (sm-test2 6) 10))
40 (defadvice sm-test2 (around sm-test activate)
41 ad-do-it (setq ad-return-value (* ad-return-value 5)))
42 (should (equal (sm-test2 6) 50))
43 (ad-deactivate 'sm-test2)
44 (should (equal (sm-test2 6) 10))
45 (ad-activate 'sm-test2)
46 (should (equal (sm-test2 6) 50))
47 (defun sm-test2 (x) (+ x 14))
48 (should (equal (sm-test2 6) 100))
49 (should (equal (null (get 'sm-test2 'defalias-fset-function)) nil))
50 (ad-remove-advice 'sm-test2 'around 'sm-test)
51 (should (equal (sm-test2 6) 100))
52 (ad-activate 'sm-test2)
53 (should (equal (sm-test2 6) 20))
54 (should (equal (null (get 'sm-test2 'defalias-fset-function)) t))
55
56 (advice-add 'sm-test3 :around
57 (lambda (f &rest args) `(toto ,(apply f args)))
58 '((name . wrap-with-toto)))
59 (defmacro sm-test3 (x) `(call-test3 ,x))
60 (should (equal (macroexpand '(sm-test3 56)) '(toto (call-test3 56))))
61
62 (defadvice sm-test4 (around wrap-with-toto activate)
63 ad-do-it (setq ad-return-value `(toto ,ad-return-value)))
64 (defmacro sm-test4 (x) `(call-test4 ,x))
65 (should (equal (macroexpand '(sm-test4 56)) '(toto (call-test4 56))))
66 (defmacro sm-test4 (x) `(call-testq ,x))
67 (should (equal (macroexpand '(sm-test4 56)) '(toto (call-testq 56))))
68
69 ;; Combining old style and new style advices.
70 (defun sm-test5 (x) (+ x 4))
71 (should (equal (sm-test5 6) 10))
72 (advice-add 'sm-test5 :around (lambda (f y) (* (funcall f y) 5)))
73 (should (equal (sm-test5 6) 50))
74 (defadvice sm-test5 (around test activate)
75 ad-do-it (setq ad-return-value (+ ad-return-value 0.1)))
76 (should (equal (sm-test5 5) 45.1))
77 (ad-deactivate 'sm-test5)
78 (should (equal (sm-test5 6) 50))
79 (ad-activate 'sm-test5)
80 (should (equal (sm-test5 6) 50.1))
81 (defun sm-test5 (x) (+ x 14))
82 (should (equal (sm-test5 6) 100.1))
83 (advice-remove 'sm-test5 (lambda (f y) (* (funcall f y) 5)))
84 (should (equal (sm-test5 6) 20.1))
85
86 ;; This used to signal an error (bug#12858).
87 (autoload 'sm-test6 "foo")
88 (defadvice sm-test6 (around test activate)
89 ad-do-it)
90
91 ;; Check interaction between advice and called-interactively-p.
92 (defun sm-test7 (&optional x) (interactive) (+ (or x 7) 4))
93 (advice-add 'sm-test7 :around
94 (lambda (f &rest args)
95 (list (cons 1 (called-interactively-p)) (apply f args))))
96 (should (equal (sm-test7) '((1 . nil) 11)))
97 (should (equal (call-interactively 'sm-test7) '((1 . t) 11)))
98 (let ((smi 7))
99 (advice-add 'sm-test7 :before
100 (lambda (&rest args)
101 (setq smi (called-interactively-p))))
102 (should (equal (list (sm-test7) smi)
103 '(((1 . nil) 11) nil)))
104 (should (equal (list (call-interactively 'sm-test7) smi)
105 '(((1 . t) 11) t))))
106 (advice-add 'sm-test7 :around
107 (lambda (f &rest args)
108 (cons (cons 2 (called-interactively-p)) (apply f args))))
109 (should (equal (call-interactively 'sm-test7) '((2 . t) (1 . t) 11)))
110 ))
111
112;; Local Variables:
113;; no-byte-compile: t
114;; End:
115
116;;; advice-tests.el ends here.
diff --git a/test/automated/bytecomp-tests.el b/test/automated/bytecomp-tests.el
index 45d5b19ee71..b7ec79fd51c 100644
--- a/test/automated/bytecomp-tests.el
+++ b/test/automated/bytecomp-tests.el
@@ -1,6 +1,6 @@
1;;; bytecomp-testsuite.el 1;;; bytecomp-testsuite.el
2 2
3;; Copyright (C) 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Shigeru Fukaya <shigeru.fukaya@gmail.com> 5;; Author: Shigeru Fukaya <shigeru.fukaya@gmail.com>
6;; Created: November 2008 6;; Created: November 2008
diff --git a/test/automated/comint-testsuite.el b/test/automated/comint-testsuite.el
index 4b2d3896407..7317c107d59 100644
--- a/test/automated/comint-testsuite.el
+++ b/test/automated/comint-testsuite.el
@@ -1,6 +1,6 @@
1;;; comint-testsuite.el 1;;; comint-testsuite.el
2 2
3;; Copyright (C) 2010-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6
diff --git a/test/automated/compile-tests.el b/test/automated/compile-tests.el
index 0203084bf38..9415ee3a17e 100644
--- a/test/automated/compile-tests.el
+++ b/test/automated/compile-tests.el
@@ -1,6 +1,6 @@
1;;; compile-tests.el --- Test suite for font parsing. 1;;; compile-tests.el --- Test suite for font parsing.
2 2
3;; Copyright (C) 2011 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Chong Yidong <cyd@stupidchicken.com> 5;; Author: Chong Yidong <cyd@stupidchicken.com>
6;; Keywords: internal 6;; Keywords: internal
@@ -199,6 +199,8 @@
199 ;; maven 199 ;; maven
200 ("FooBar.java:[111,53] no interface expected here" 200 ("FooBar.java:[111,53] no interface expected here"
201 1 53 111 "FooBar.java") 201 1 53 111 "FooBar.java")
202 (" [ERROR] /Users/cinsk/hello.java:[651,96] ';' expected"
203 15 96 651 "/Users/cinsk/hello.java") ;Bug#11517.
202 ;; mips-1 mips-2 204 ;; mips-1 mips-2
203 ("TrimMask (255) in solomon.c may be indistinguishable from TrimMasks (93) in solomo.c due to truncation" 205 ("TrimMask (255) in solomon.c may be indistinguishable from TrimMasks (93) in solomo.c due to truncation"
204 11 nil 255 "solomon.c") 206 11 nil 255 "solomon.c")
@@ -213,6 +215,10 @@
213 1 nil 23 "d:\\tmp\\test.c") 215 1 nil 23 "d:\\tmp\\test.c")
214 ("d:\\tmp\\test.c(1145) : see declaration of 'nsRefPtr'" 216 ("d:\\tmp\\test.c(1145) : see declaration of 'nsRefPtr'"
215 1 nil 1145 "d:\\tmp\\test.c") 217 1 nil 1145 "d:\\tmp\\test.c")
218 ("1>test_main.cpp(29): error C2144: syntax error : 'int' should be preceded by ';'"
219 3 nil 29 "test_main.cpp")
220 ("1>test_main.cpp(29): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int"
221 3 nil 29 "test_main.cpp")
216 ;; watcom 222 ;; watcom
217 ("..\src\ctrl\lister.c(109): Error! E1009: Expecting ';' but found '{'" 223 ("..\src\ctrl\lister.c(109): Error! E1009: Expecting ';' but found '{'"
218 1 nil 109 "..\src\ctrl\lister.c") 224 1 nil 109 "..\src\ctrl\lister.c")
diff --git a/test/automated/ert-tests.el b/test/automated/ert-tests.el
index 1fe6352e1fe..1aef1921871 100644
--- a/test/automated/ert-tests.el
+++ b/test/automated/ert-tests.el
@@ -1,6 +1,6 @@
1;;; ert-tests.el --- ERT's self-tests 1;;; ert-tests.el --- ERT's self-tests -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2007-2008, 2010-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2007-2008, 2010-2012 Free Software Foundation, Inc.
4 4
5;; Author: Christian Ohler <ohler@gnu.org> 5;; Author: Christian Ohler <ohler@gnu.org>
6 6
@@ -27,7 +27,7 @@
27;;; Code: 27;;; Code:
28 28
29(eval-when-compile 29(eval-when-compile
30 (require 'cl)) 30 (require 'cl-lib))
31(require 'ert) 31(require 'ert)
32 32
33 33
@@ -45,7 +45,7 @@
45 ;; The buffer name chosen here should not compete with the default 45 ;; The buffer name chosen here should not compete with the default
46 ;; results buffer name for completion in `switch-to-buffer'. 46 ;; results buffer name for completion in `switch-to-buffer'.
47 (let ((stats (ert-run-tests-interactively "^ert-" " *ert self-tests*"))) 47 (let ((stats (ert-run-tests-interactively "^ert-" " *ert self-tests*")))
48 (assert ert--test-body-was-run) 48 (cl-assert ert--test-body-was-run)
49 (if (zerop (ert-stats-completed-unexpected stats)) 49 (if (zerop (ert-stats-completed-unexpected stats))
50 ;; Hide results window only when everything went well. 50 ;; Hide results window only when everything went well.
51 (set-window-configuration window-configuration) 51 (set-window-configuration window-configuration)
@@ -71,26 +71,26 @@ failed or if there was a problem."
71 71
72(ert-deftest ert-test-nested-test-body-runs () 72(ert-deftest ert-test-nested-test-body-runs ()
73 "Test that nested test bodies run." 73 "Test that nested test bodies run."
74 (lexical-let ((was-run nil)) 74 (let ((was-run nil))
75 (let ((test (make-ert-test :body (lambda () 75 (let ((test (make-ert-test :body (lambda ()
76 (setq was-run t))))) 76 (setq was-run t)))))
77 (assert (not was-run)) 77 (cl-assert (not was-run))
78 (ert-run-test test) 78 (ert-run-test test)
79 (assert was-run)))) 79 (cl-assert was-run))))
80 80
81 81
82;;; Test that pass/fail works. 82;;; Test that pass/fail works.
83(ert-deftest ert-test-pass () 83(ert-deftest ert-test-pass ()
84 (let ((test (make-ert-test :body (lambda ())))) 84 (let ((test (make-ert-test :body (lambda ()))))
85 (let ((result (ert-run-test test))) 85 (let ((result (ert-run-test test)))
86 (assert (ert-test-passed-p result))))) 86 (cl-assert (ert-test-passed-p result)))))
87 87
88(ert-deftest ert-test-fail () 88(ert-deftest ert-test-fail ()
89 (let ((test (make-ert-test :body (lambda () (ert-fail "failure message"))))) 89 (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
90 (let ((result (let ((ert-debug-on-error nil)) 90 (let ((result (let ((ert-debug-on-error nil))
91 (ert-run-test test)))) 91 (ert-run-test test))))
92 (assert (ert-test-failed-p result) t) 92 (cl-assert (ert-test-failed-p result) t)
93 (assert (equal (ert-test-result-with-condition-condition result) 93 (cl-assert (equal (ert-test-result-with-condition-condition result)
94 '(ert-test-failed "failure message")) 94 '(ert-test-failed "failure message"))
95 t)))) 95 t))))
96 96
@@ -100,50 +100,50 @@ failed or if there was a problem."
100 (progn 100 (progn
101 (let ((ert-debug-on-error t)) 101 (let ((ert-debug-on-error t))
102 (ert-run-test test)) 102 (ert-run-test test))
103 (assert nil)) 103 (cl-assert nil))
104 ((error) 104 ((error)
105 (assert (equal condition '(ert-test-failed "failure message")) t))))) 105 (cl-assert (equal condition '(ert-test-failed "failure message")) t)))))
106 106
107(ert-deftest ert-test-fail-debug-with-debugger-1 () 107(ert-deftest ert-test-fail-debug-with-debugger-1 ()
108 (let ((test (make-ert-test :body (lambda () (ert-fail "failure message"))))) 108 (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
109 (let ((debugger (lambda (&rest debugger-args) 109 (let ((debugger (lambda (&rest _args)
110 (assert nil)))) 110 (cl-assert nil))))
111 (let ((ert-debug-on-error nil)) 111 (let ((ert-debug-on-error nil))
112 (ert-run-test test))))) 112 (ert-run-test test)))))
113 113
114(ert-deftest ert-test-fail-debug-with-debugger-2 () 114(ert-deftest ert-test-fail-debug-with-debugger-2 ()
115 (let ((test (make-ert-test :body (lambda () (ert-fail "failure message"))))) 115 (let ((test (make-ert-test :body (lambda () (ert-fail "failure message")))))
116 (block nil 116 (cl-block nil
117 (let ((debugger (lambda (&rest debugger-args) 117 (let ((debugger (lambda (&rest _args)
118 (return-from nil nil)))) 118 (cl-return-from nil nil))))
119 (let ((ert-debug-on-error t)) 119 (let ((ert-debug-on-error t))
120 (ert-run-test test)) 120 (ert-run-test test))
121 (assert nil))))) 121 (cl-assert nil)))))
122 122
123(ert-deftest ert-test-fail-debug-nested-with-debugger () 123(ert-deftest ert-test-fail-debug-nested-with-debugger ()
124 (let ((test (make-ert-test :body (lambda () 124 (let ((test (make-ert-test :body (lambda ()
125 (let ((ert-debug-on-error t)) 125 (let ((ert-debug-on-error t))
126 (ert-fail "failure message")))))) 126 (ert-fail "failure message"))))))
127 (let ((debugger (lambda (&rest debugger-args) 127 (let ((debugger (lambda (&rest _args)
128 (assert nil nil "Assertion a")))) 128 (cl-assert nil nil "Assertion a"))))
129 (let ((ert-debug-on-error nil)) 129 (let ((ert-debug-on-error nil))
130 (ert-run-test test)))) 130 (ert-run-test test))))
131 (let ((test (make-ert-test :body (lambda () 131 (let ((test (make-ert-test :body (lambda ()
132 (let ((ert-debug-on-error nil)) 132 (let ((ert-debug-on-error nil))
133 (ert-fail "failure message")))))) 133 (ert-fail "failure message"))))))
134 (block nil 134 (cl-block nil
135 (let ((debugger (lambda (&rest debugger-args) 135 (let ((debugger (lambda (&rest _args)
136 (return-from nil nil)))) 136 (cl-return-from nil nil))))
137 (let ((ert-debug-on-error t)) 137 (let ((ert-debug-on-error t))
138 (ert-run-test test)) 138 (ert-run-test test))
139 (assert nil nil "Assertion b"))))) 139 (cl-assert nil nil "Assertion b")))))
140 140
141(ert-deftest ert-test-error () 141(ert-deftest ert-test-error ()
142 (let ((test (make-ert-test :body (lambda () (error "Error message"))))) 142 (let ((test (make-ert-test :body (lambda () (error "Error message")))))
143 (let ((result (let ((ert-debug-on-error nil)) 143 (let ((result (let ((ert-debug-on-error nil))
144 (ert-run-test test)))) 144 (ert-run-test test))))
145 (assert (ert-test-failed-p result) t) 145 (cl-assert (ert-test-failed-p result) t)
146 (assert (equal (ert-test-result-with-condition-condition result) 146 (cl-assert (equal (ert-test-result-with-condition-condition result)
147 '(error "Error message")) 147 '(error "Error message"))
148 t)))) 148 t))))
149 149
@@ -153,9 +153,9 @@ failed or if there was a problem."
153 (progn 153 (progn
154 (let ((ert-debug-on-error t)) 154 (let ((ert-debug-on-error t))
155 (ert-run-test test)) 155 (ert-run-test test))
156 (assert nil)) 156 (cl-assert nil))
157 ((error) 157 ((error)
158 (assert (equal condition '(error "Error message")) t))))) 158 (cl-assert (equal condition '(error "Error message")) t)))))
159 159
160 160
161;;; Test that `should' works. 161;;; Test that `should' works.
@@ -163,13 +163,13 @@ failed or if there was a problem."
163 (let ((test (make-ert-test :body (lambda () (should nil))))) 163 (let ((test (make-ert-test :body (lambda () (should nil)))))
164 (let ((result (let ((ert-debug-on-error nil)) 164 (let ((result (let ((ert-debug-on-error nil))
165 (ert-run-test test)))) 165 (ert-run-test test))))
166 (assert (ert-test-failed-p result) t) 166 (cl-assert (ert-test-failed-p result) t)
167 (assert (equal (ert-test-result-with-condition-condition result) 167 (cl-assert (equal (ert-test-result-with-condition-condition result)
168 '(ert-test-failed ((should nil) :form nil :value nil))) 168 '(ert-test-failed ((should nil) :form nil :value nil)))
169 t))) 169 t)))
170 (let ((test (make-ert-test :body (lambda () (should t))))) 170 (let ((test (make-ert-test :body (lambda () (should t)))))
171 (let ((result (ert-run-test test))) 171 (let ((result (ert-run-test test)))
172 (assert (ert-test-passed-p result) t)))) 172 (cl-assert (ert-test-passed-p result) t))))
173 173
174(ert-deftest ert-test-should-value () 174(ert-deftest ert-test-should-value ()
175 (should (eql (should 'foo) 'foo)) 175 (should (eql (should 'foo) 'foo))
@@ -179,17 +179,18 @@ failed or if there was a problem."
179 (let ((test (make-ert-test :body (lambda () (should-not t))))) 179 (let ((test (make-ert-test :body (lambda () (should-not t)))))
180 (let ((result (let ((ert-debug-on-error nil)) 180 (let ((result (let ((ert-debug-on-error nil))
181 (ert-run-test test)))) 181 (ert-run-test test))))
182 (assert (ert-test-failed-p result) t) 182 (cl-assert (ert-test-failed-p result) t)
183 (assert (equal (ert-test-result-with-condition-condition result) 183 (cl-assert (equal (ert-test-result-with-condition-condition result)
184 '(ert-test-failed ((should-not t) :form t :value t))) 184 '(ert-test-failed ((should-not t) :form t :value t)))
185 t))) 185 t)))
186 (let ((test (make-ert-test :body (lambda () (should-not nil))))) 186 (let ((test (make-ert-test :body (lambda () (should-not nil)))))
187 (let ((result (ert-run-test test))) 187 (let ((result (ert-run-test test)))
188 (assert (ert-test-passed-p result))))) 188 (cl-assert (ert-test-passed-p result)))))
189
189 190
190(ert-deftest ert-test-should-with-macrolet () 191(ert-deftest ert-test-should-with-macrolet ()
191 (let ((test (make-ert-test :body (lambda () 192 (let ((test (make-ert-test :body (lambda ()
192 (macrolet ((foo () `(progn t nil))) 193 (cl-macrolet ((foo () `(progn t nil)))
193 (should (foo))))))) 194 (should (foo)))))))
194 (let ((result (let ((ert-debug-on-error nil)) 195 (let ((result (let ((ert-debug-on-error nil))
195 (ert-run-test test)))) 196 (ert-run-test test))))
@@ -303,32 +304,33 @@ This macro is used to test if macroexpansion in `should' works."
303 304
304(ert-deftest ert-test-should-failure-debugging () 305(ert-deftest ert-test-should-failure-debugging ()
305 "Test that `should' errors contain the information we expect them to." 306 "Test that `should' errors contain the information we expect them to."
306 (loop for (body expected-condition) in 307 (cl-loop
307 `((,(lambda () (let ((x nil)) (should x))) 308 for (body expected-condition) in
308 (ert-test-failed ((should x) :form x :value nil))) 309 `((,(lambda () (let ((x nil)) (should x)))
309 (,(lambda () (let ((x t)) (should-not x))) 310 (ert-test-failed ((should x) :form x :value nil)))
310 (ert-test-failed ((should-not x) :form x :value t))) 311 (,(lambda () (let ((x t)) (should-not x)))
311 (,(lambda () (let ((x t)) (should (not x)))) 312 (ert-test-failed ((should-not x) :form x :value t)))
312 (ert-test-failed ((should (not x)) :form (not t) :value nil))) 313 (,(lambda () (let ((x t)) (should (not x))))
313 (,(lambda () (let ((x nil)) (should-not (not x)))) 314 (ert-test-failed ((should (not x)) :form (not t) :value nil)))
314 (ert-test-failed ((should-not (not x)) :form (not nil) :value t))) 315 (,(lambda () (let ((x nil)) (should-not (not x))))
315 (,(lambda () (let ((x t) (y nil)) (should-not 316 (ert-test-failed ((should-not (not x)) :form (not nil) :value t)))
316 (ert--test-my-list x y)))) 317 (,(lambda () (let ((x t) (y nil)) (should-not
317 (ert-test-failed 318 (ert--test-my-list x y))))
318 ((should-not (ert--test-my-list x y)) 319 (ert-test-failed
319 :form (list t nil) 320 ((should-not (ert--test-my-list x y))
320 :value (t nil)))) 321 :form (list t nil)
321 (,(lambda () (let ((x t)) (should (error "Foo")))) 322 :value (t nil))))
322 (error "Foo"))) 323 (,(lambda () (let ((_x t)) (should (error "Foo"))))
323 do 324 (error "Foo")))
324 (let ((test (make-ert-test :body body))) 325 do
325 (condition-case actual-condition 326 (let ((test (make-ert-test :body body)))
326 (progn 327 (condition-case actual-condition
327 (let ((ert-debug-on-error t)) 328 (progn
328 (ert-run-test test)) 329 (let ((ert-debug-on-error t))
329 (assert nil)) 330 (ert-run-test test))
330 ((error) 331 (cl-assert nil))
331 (should (equal actual-condition expected-condition))))))) 332 ((error)
333 (should (equal actual-condition expected-condition)))))))
332 334
333(ert-deftest ert-test-deftest () 335(ert-deftest ert-test-deftest ()
334 (should (equal (macroexpand '(ert-deftest abc () "foo" :tags '(bar))) 336 (should (equal (macroexpand '(ert-deftest abc () "foo" :tags '(bar)))
@@ -520,7 +522,7 @@ This macro is used to test if macroexpansion in `should' works."
520 (setf (cdr (last a)) (cddr a)) 522 (setf (cdr (last a)) (cddr a))
521 (should (not (ert--proper-list-p a)))) 523 (should (not (ert--proper-list-p a))))
522 (let ((a (list 1 2 3 4))) 524 (let ((a (list 1 2 3 4)))
523 (setf (cdr (last a)) (cdddr a)) 525 (setf (cdr (last a)) (cl-cdddr a))
524 (should (not (ert--proper-list-p a))))) 526 (should (not (ert--proper-list-p a)))))
525 527
526(ert-deftest ert-test-parse-keys-and-body () 528(ert-deftest ert-test-parse-keys-and-body ()
@@ -657,14 +659,14 @@ This macro is used to test if macroexpansion in `should' works."
657 (i 0)) 659 (i 0))
658 (let ((result (ert--remove-if-not (lambda (x) 660 (let ((result (ert--remove-if-not (lambda (x)
659 (should (eql x (nth i list))) 661 (should (eql x (nth i list)))
660 (incf i) 662 (cl-incf i)
661 (member i '(2 3))) 663 (member i '(2 3)))
662 list))) 664 list)))
663 (should (equal i 4)) 665 (should (equal i 4))
664 (should (equal result '(b c))) 666 (should (equal result '(b c)))
665 (should (equal list '(a b c d))))) 667 (should (equal list '(a b c d)))))
666 (should (equal '() 668 (should (equal '()
667 (ert--remove-if-not (lambda (x) (should nil)) '())))) 669 (ert--remove-if-not (lambda (_x) (should nil)) '()))))
668 670
669(ert-deftest ert-test-remove* () 671(ert-deftest ert-test-remove* ()
670 (let ((list (list 'a 'b 'c 'd)) 672 (let ((list (list 'a 'b 'c 'd))
@@ -676,13 +678,13 @@ This macro is used to test if macroexpansion in `should' works."
676 (should (eql x (nth key-index list))) 678 (should (eql x (nth key-index list)))
677 (prog1 679 (prog1
678 (list key-index x) 680 (list key-index x)
679 (incf key-index))) 681 (cl-incf key-index)))
680 :test 682 :test
681 (lambda (a b) 683 (lambda (a b)
682 (should (eql a 'foo)) 684 (should (eql a 'foo))
683 (should (equal b (list test-index 685 (should (equal b (list test-index
684 (nth test-index list)))) 686 (nth test-index list))))
685 (incf test-index) 687 (cl-incf test-index)
686 (member test-index '(2 3)))))) 688 (member test-index '(2 3))))))
687 (should (equal key-index 4)) 689 (should (equal key-index 4))
688 (should (equal test-index 4)) 690 (should (equal test-index 4))
diff --git a/test/automated/ert-x-tests.el b/test/automated/ert-x-tests.el
index ff056b40b36..e03c8475442 100644
--- a/test/automated/ert-x-tests.el
+++ b/test/automated/ert-x-tests.el
@@ -1,6 +1,6 @@
1;;; ert-x-tests.el --- Tests for ert-x.el 1;;; ert-x-tests.el --- Tests for ert-x.el
2 2
3;; Copyright (C) 2008, 2010-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008, 2010-2012 Free Software Foundation, Inc.
4 4
5;; Author: Phil Hagelberg 5;; Author: Phil Hagelberg
6;; Christian Ohler <ohler@gnu.org> 6;; Christian Ohler <ohler@gnu.org>
@@ -28,7 +28,7 @@
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile 30(eval-when-compile
31 (require 'cl)) 31 (require 'cl-lib))
32(require 'ert) 32(require 'ert)
33(require 'ert-x) 33(require 'ert-x)
34 34
@@ -103,79 +103,79 @@
103 103
104(ert-deftest ert-test-run-tests-interactively-2 () 104(ert-deftest ert-test-run-tests-interactively-2 ()
105 :tags '(:causes-redisplay) 105 :tags '(:causes-redisplay)
106 (let ((passing-test (make-ert-test :name 'passing-test 106 (let* ((passing-test (make-ert-test :name 'passing-test
107 :body (lambda () (ert-pass)))) 107 :body (lambda () (ert-pass))))
108 (failing-test (make-ert-test :name 'failing-test 108 (failing-test (make-ert-test :name 'failing-test
109 :body (lambda () 109 :body (lambda ()
110 (ert-info ((propertize "foo\nbar" 110 (ert-info ((propertize "foo\nbar"
111 'a 'b)) 111 'a 'b))
112 (ert-fail 112 (ert-fail
113 "failure message")))))) 113 "failure message")))))
114 (let ((ert-debug-on-error nil)) 114 (ert-debug-on-error nil)
115 (let* ((buffer-name (generate-new-buffer-name "*ert-test-run-tests*")) 115 (buffer-name (generate-new-buffer-name "*ert-test-run-tests*"))
116 (messages nil) 116 (messages nil)
117 (mock-message-fn 117 (mock-message-fn
118 (lambda (format-string &rest args) 118 (lambda (format-string &rest args)
119 (push (apply #'format format-string args) messages)))) 119 (push (apply #'format format-string args) messages))))
120 (flet ((expected-string (with-font-lock-p) 120 (cl-flet ((expected-string (with-font-lock-p)
121 (ert-propertized-string 121 (ert-propertized-string
122 "Selector: (member <passing-test> <failing-test>)\n" 122 "Selector: (member <passing-test> <failing-test>)\n"
123 "Passed: 1\n" 123 "Passed: 1\n"
124 "Failed: 1 (1 unexpected)\n" 124 "Failed: 1 (1 unexpected)\n"
125 "Total: 2/2\n\n" 125 "Total: 2/2\n\n"
126 "Started at:\n" 126 "Started at:\n"
127 "Finished.\n" 127 "Finished.\n"
128 "Finished at:\n\n" 128 "Finished at:\n\n"
129 `(category ,(button-category-symbol 129 `(category ,(button-category-symbol
130 'ert--results-progress-bar-button) 130 'ert--results-progress-bar-button)
131 button (t) 131 button (t)
132 face ,(if with-font-lock-p 132 face ,(if with-font-lock-p
133 'ert-test-result-unexpected 133 'ert-test-result-unexpected
134 'button)) 134 'button))
135 ".F" nil "\n\n" 135 ".F" nil "\n\n"
136 `(category ,(button-category-symbol 136 `(category ,(button-category-symbol
137 'ert--results-expand-collapse-button) 137 'ert--results-expand-collapse-button)
138 button (t) 138 button (t)
139 face ,(if with-font-lock-p 139 face ,(if with-font-lock-p
140 'ert-test-result-unexpected 140 'ert-test-result-unexpected
141 'button)) 141 'button))
142 "F" nil " " 142 "F" nil " "
143 `(category ,(button-category-symbol 143 `(category ,(button-category-symbol
144 'ert--test-name-button) 144 'ert--test-name-button)
145 button (t) 145 button (t)
146 ert-test-name failing-test) 146 ert-test-name failing-test)
147 "failing-test" 147 "failing-test"
148 nil "\n Info: " '(a b) "foo\n" 148 nil "\n Info: " '(a b) "foo\n"
149 nil " " '(a b) "bar" 149 nil " " '(a b) "bar"
150 nil "\n (ert-test-failed \"failure message\")\n\n\n" 150 nil "\n (ert-test-failed \"failure message\")\n\n\n"
151 ))) 151 )))
152 (save-window-excursion 152 (save-window-excursion
153 (unwind-protect 153 (unwind-protect
154 (let ((case-fold-search nil)) 154 (let ((case-fold-search nil))
155 (ert-run-tests-interactively 155 (ert-run-tests-interactively
156 `(member ,passing-test ,failing-test) buffer-name 156 `(member ,passing-test ,failing-test) buffer-name
157 mock-message-fn) 157 mock-message-fn)
158 (should (equal messages `(,(concat 158 (should (equal messages `(,(concat
159 "Ran 2 tests, 1 results were " 159 "Ran 2 tests, 1 results were "
160 "as expected, 1 unexpected")))) 160 "as expected, 1 unexpected"))))
161 (with-current-buffer buffer-name 161 (with-current-buffer buffer-name
162 (font-lock-mode 0) 162 (font-lock-mode 0)
163 (should (ert-equal-including-properties 163 (should (ert-equal-including-properties
164 (ert-filter-string (buffer-string) 164 (ert-filter-string (buffer-string)
165 '("Started at:\\(.*\\)$" 1) 165 '("Started at:\\(.*\\)$" 1)
166 '("Finished at:\\(.*\\)$" 1)) 166 '("Finished at:\\(.*\\)$" 1))
167 (expected-string nil))) 167 (expected-string nil)))
168 ;; `font-lock-mode' only works if interactive, so 168 ;; `font-lock-mode' only works if interactive, so
169 ;; pretend we are. 169 ;; pretend we are.
170 (let ((noninteractive nil)) 170 (let ((noninteractive nil))
171 (font-lock-mode 1)) 171 (font-lock-mode 1))
172 (should (ert-equal-including-properties 172 (should (ert-equal-including-properties
173 (ert-filter-string (buffer-string) 173 (ert-filter-string (buffer-string)
174 '("Started at:\\(.*\\)$" 1) 174 '("Started at:\\(.*\\)$" 1)
175 '("Finished at:\\(.*\\)$" 1)) 175 '("Finished at:\\(.*\\)$" 1))
176 (expected-string t))))) 176 (expected-string t)))))
177 (when (get-buffer buffer-name) 177 (when (get-buffer buffer-name)
178 (kill-buffer buffer-name))))))))) 178 (kill-buffer buffer-name)))))))
179 179
180(ert-deftest ert-test-describe-test () 180(ert-deftest ert-test-describe-test ()
181 "Tests `ert-describe-test'." 181 "Tests `ert-describe-test'."
@@ -233,8 +233,8 @@ desired effect."
233 (should (equal (buffer-string) "")) 233 (should (equal (buffer-string) ""))
234 (let ((message-log-max 2)) 234 (let ((message-log-max 2))
235 (let ((message-log-max t)) 235 (let ((message-log-max t))
236 (loop for i below 4 do 236 (cl-loop for i below 4 do
237 (message "%s" i)) 237 (message "%s" i))
238 (should (equal (buffer-string) "0\n1\n2\n3\n"))) 238 (should (equal (buffer-string) "0\n1\n2\n3\n")))
239 (should (equal (buffer-string) "0\n1\n2\n3\n")) 239 (should (equal (buffer-string) "0\n1\n2\n3\n"))
240 (message "") 240 (message "")
@@ -244,28 +244,28 @@ desired effect."
244 244
245(ert-deftest ert-test-force-message-log-buffer-truncation () 245(ert-deftest ert-test-force-message-log-buffer-truncation ()
246 :tags '(:causes-redisplay) 246 :tags '(:causes-redisplay)
247 (labels ((body () 247 (cl-labels ((body ()
248 (loop for i below 3 do 248 (cl-loop for i below 3 do
249 (message "%s" i))) 249 (message "%s" i)))
250 ;; Uses the implicit messages buffer truncation implemented 250 ;; Uses the implicit messages buffer truncation implemented
251 ;; in Emacs' C core. 251 ;; in Emacs' C core.
252 (c (x) 252 (c (x)
253 (ert-with-buffer-renamed ("*Messages*") 253 (ert-with-buffer-renamed ("*Messages*")
254 (let ((message-log-max x)) 254 (let ((message-log-max x))
255 (body)) 255 (body))
256 (with-current-buffer "*Messages*" 256 (with-current-buffer "*Messages*"
257 (buffer-string)))) 257 (buffer-string))))
258 ;; Uses our lisp reimplementation. 258 ;; Uses our lisp reimplementation.
259 (lisp (x) 259 (lisp (x)
260 (ert-with-buffer-renamed ("*Messages*") 260 (ert-with-buffer-renamed ("*Messages*")
261 (let ((message-log-max t)) 261 (let ((message-log-max t))
262 (body)) 262 (body))
263 (let ((message-log-max x)) 263 (let ((message-log-max x))
264 (ert--force-message-log-buffer-truncation)) 264 (ert--force-message-log-buffer-truncation))
265 (with-current-buffer "*Messages*" 265 (with-current-buffer "*Messages*"
266 (buffer-string))))) 266 (buffer-string)))))
267 (loop for x in '(0 1 2 3 4 t) do 267 (cl-loop for x in '(0 1 2 3 4 t) do
268 (should (equal (c x) (lisp x)))))) 268 (should (equal (c x) (lisp x))))))
269 269
270 270
271(provide 'ert-x-tests) 271(provide 'ert-x-tests)
diff --git a/test/automated/f90.el b/test/automated/f90.el
index 5d75d5cd0fb..25b77f07ad3 100644
--- a/test/automated/f90.el
+++ b/test/automated/f90.el
@@ -1,6 +1,6 @@
1;;; f90.el --- tests for progmodes/f90.el 1;;; f90.el --- tests for progmodes/f90.el
2 2
3;; Copyright (C) 2011 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Glenn Morris <rgm@gnu.org> 5;; Author: Glenn Morris <rgm@gnu.org>
6 6
diff --git a/test/automated/files.el b/test/automated/files.el
new file mode 100644
index 00000000000..b6011395bfd
--- /dev/null
+++ b/test/automated/files.el
@@ -0,0 +1,149 @@
1;;; files.el --- tests for file handling.
2
3;; Copyright (C) 2012 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;;; Code:
21
22(require 'ert)
23
24;; Set to t if the local variable was set, `query' if the query was
25;; triggered.
26(defvar files-test-result)
27
28(defvar files-test-safe-result)
29(put 'files-test-safe-result 'safe-local-variable 'booleanp)
30
31(defun files-test-fun1 ()
32 (setq files-test-result t))
33
34;; Test combinations:
35;; `enable-local-variables' t, nil, :safe, :all, or something else.
36;; `enable-local-eval' t, nil, or something else.
37
38(defvar files-test-local-variable-data
39 ;; Unsafe eval form
40 '((("eval: (files-test-fun1)")
41 (t t (eq files-test-result t))
42 (t nil (eq files-test-result nil))
43 (t maybe (eq files-test-result 'query))
44 (nil t (eq files-test-result nil))
45 (nil nil (eq files-test-result nil))
46 (nil maybe (eq files-test-result nil))
47 (:safe t (eq files-test-result nil))
48 (:safe nil (eq files-test-result nil))
49 (:safe maybe (eq files-test-result nil))
50 (:all t (eq files-test-result t))
51 (:all nil (eq files-test-result nil))
52 (:all maybe (eq files-test-result t)) ; This combination is ambiguous.
53 (maybe t (eq files-test-result 'query))
54 (maybe nil (eq files-test-result 'query))
55 (maybe maybe (eq files-test-result 'query)))
56 ;; Unsafe local variable value
57 (("files-test-result: t")
58 (t t (eq files-test-result 'query))
59 (t nil (eq files-test-result 'query))
60 (t maybe (eq files-test-result 'query))
61 (nil t (eq files-test-result nil))
62 (nil nil (eq files-test-result nil))
63 (nil maybe (eq files-test-result nil))
64 (:safe t (eq files-test-result nil))
65 (:safe nil (eq files-test-result nil))
66 (:safe maybe (eq files-test-result nil))
67 (:all t (eq files-test-result t))
68 (:all nil (eq files-test-result t))
69 (:all maybe (eq files-test-result t))
70 (maybe t (eq files-test-result 'query))
71 (maybe nil (eq files-test-result 'query))
72 (maybe maybe (eq files-test-result 'query)))
73 ;; Safe local variable
74 (("files-test-safe-result: t")
75 (t t (eq files-test-safe-result t))
76 (t nil (eq files-test-safe-result t))
77 (t maybe (eq files-test-safe-result t))
78 (nil t (eq files-test-safe-result nil))
79 (nil nil (eq files-test-safe-result nil))
80 (nil maybe (eq files-test-safe-result nil))
81 (:safe t (eq files-test-safe-result t))
82 (:safe nil (eq files-test-safe-result t))
83 (:safe maybe (eq files-test-safe-result t))
84 (:all t (eq files-test-safe-result t))
85 (:all nil (eq files-test-safe-result t))
86 (:all maybe (eq files-test-safe-result t))
87 (maybe t (eq files-test-result 'query))
88 (maybe nil (eq files-test-result 'query))
89 (maybe maybe (eq files-test-result 'query)))
90 ;; Safe local variable with unsafe value
91 (("files-test-safe-result: 1")
92 (t t (eq files-test-result 'query))
93 (t nil (eq files-test-result 'query))
94 (t maybe (eq files-test-result 'query))
95 (nil t (eq files-test-safe-result nil))
96 (nil nil (eq files-test-safe-result nil))
97 (nil maybe (eq files-test-safe-result nil))
98 (:safe t (eq files-test-safe-result nil))
99 (:safe nil (eq files-test-safe-result nil))
100 (:safe maybe (eq files-test-safe-result nil))
101 (:all t (eq files-test-safe-result 1))
102 (:all nil (eq files-test-safe-result 1))
103 (:all maybe (eq files-test-safe-result 1))
104 (maybe t (eq files-test-result 'query))
105 (maybe nil (eq files-test-result 'query))
106 (maybe maybe (eq files-test-result 'query))))
107 "List of file-local variable tests.
108Each list element should have the form
109
110 (LOCAL-VARS-LIST . TEST-LIST)
111
112where LOCAL-VARS-LISTS should be a list of local variable
113definitions (strings) and TEST-LIST is a list of tests to
114perform. Each entry of TEST-LIST should have the form
115
116 (ENABLE-LOCAL-VARIABLES ENABLE-LOCAL-EVAL FORM)
117
118where ENABLE-LOCAL-VARIABLES is the value to assign to
119`enable-local-variables', ENABLE-LOCAL-EVAL is the value to
120assign to `enable-local-eval', and FORM is a desired `should'
121form.")
122
123(defun file-test--do-local-variables-test (str test-settings)
124 (with-temp-buffer
125 (insert str)
126 (let ((enable-local-variables (nth 0 test-settings))
127 (enable-local-eval (nth 1 test-settings))
128 (files-test-result nil)
129 (files-test-queried nil)
130 (files-test-safe-result nil))
131 (hack-local-variables)
132 (eval (nth 2 test-settings)))))
133
134(ert-deftest files-test-local-variables ()
135 "Test the file-local variables implementation."
136 (unwind-protect
137 (progn
138 (defadvice hack-local-variables-confirm (around files-test activate)
139 (setq files-test-result 'query)
140 nil)
141 (dolist (test files-test-local-variable-data)
142 (let ((str (concat "text\n\n;; Local Variables:\n;; "
143 (mapconcat 'identity (car test) "\n;; ")
144 "\n;; End:\n")))
145 (dolist (subtest (cdr test))
146 (should (file-test--do-local-variables-test str subtest))))))
147 (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test)))
148
149;;; files.el ends here
diff --git a/test/automated/font-parse-tests.el b/test/automated/font-parse-tests.el
index 5ba8ad2be32..6aeaee4adce 100644
--- a/test/automated/font-parse-tests.el
+++ b/test/automated/font-parse-tests.el
@@ -1,6 +1,6 @@
1;;; font-parse-tests.el --- Test suite for font parsing. 1;;; font-parse-tests.el --- Test suite for font parsing.
2 2
3;; Copyright (C) 2011 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Chong Yidong <cyd@stupidchicken.com> 5;; Author: Chong Yidong <cyd@stupidchicken.com>
6;; Keywords: internal 6;; Keywords: internal
diff --git a/test/automated/gnus-tests.el b/test/automated/gnus-tests.el
index f5742261d5b..3b5340bcdd3 100644
--- a/test/automated/gnus-tests.el
+++ b/test/automated/gnus-tests.el
@@ -1,6 +1,6 @@
1;;; gnus-tests.el --- Wrapper for the Gnus tests 1;;; gnus-tests.el --- Wrapper for the Gnus tests
2 2
3;; Copyright (C) 2011 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Teodor Zlatanov <tzz@lifelogs.com> 5;; Author: Teodor Zlatanov <tzz@lifelogs.com>
6 6
diff --git a/test/automated/icalendar-tests.el b/test/automated/icalendar-tests.el
index 6ed1d73767a..58b8379bb11 100644
--- a/test/automated/icalendar-tests.el
+++ b/test/automated/icalendar-tests.el
@@ -1,6 +1,6 @@
1;; icalendar-tests.el --- Test suite for icalendar.el 1;; icalendar-tests.el --- Test suite for icalendar.el
2 2
3;; Copyright (C) 2005, 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2005, 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Ulf Jasper <ulf.jasper@web.de> 5;; Author: Ulf Jasper <ulf.jasper@web.de>
6;; Created: March 2005 6;; Created: March 2005
@@ -188,7 +188,7 @@ END:VTIMEZONE
188 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" 188 (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
189 (cdr result))) 189 (cdr result)))
190 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE 190 (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
191TZID:anothername 191TZID:anothername\, with a comma
192BEGIN:STANDARD 192BEGIN:STANDARD
193DTSTART:16010101T040000 193DTSTART:16010101T040000
194TZOFFSETFROM:+0300 194TZOFFSETFROM:+0300
@@ -204,7 +204,7 @@ END:DAYLIGHT
204END:VTIMEZONE 204END:VTIMEZONE
205")) 205"))
206 (setq result (icalendar--parse-vtimezone vtimezone)) 206 (setq result (icalendar--parse-vtimezone vtimezone))
207 (should (string= "anothername" (car result))) 207 (should (string= "anothername, with a comma" (car result)))
208 (message (cdr result)) 208 (message (cdr result))
209 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" 209 (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
210 (cdr result))))) 210 (cdr result)))))
@@ -682,7 +682,7 @@ Argument EXPECTED-AMERICAN expected american style diary string."
682 (unless (eq (char-before) ?\n) 682 (unless (eq (char-before) ?\n)
683 (insert "\n")) 683 (insert "\n"))
684 (insert "END:VEVENT\nEND:VCALENDAR\n")) 684 (insert "END:VEVENT\nEND:VCALENDAR\n"))
685 (let ((icalendar-import-format "%s%d%l%o%t%u%c") 685 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
686 (icalendar-import-format-summary "%s") 686 (icalendar-import-format-summary "%s")
687 (icalendar-import-format-location "\n Location: %s") 687 (icalendar-import-format-location "\n Location: %s")
688 (icalendar-import-format-description "\n Desc: %s") 688 (icalendar-import-format-description "\n Desc: %s")
@@ -690,6 +690,7 @@ Argument EXPECTED-AMERICAN expected american style diary string."
690 (icalendar-import-format-status "\n Status: %s") 690 (icalendar-import-format-status "\n Status: %s")
691 (icalendar-import-format-url "\n URL: %s") 691 (icalendar-import-format-url "\n URL: %s")
692 (icalendar-import-format-class "\n Class: %s") 692 (icalendar-import-format-class "\n Class: %s")
693 (icalendar-import-format-uid "\n UID: %s")
693 calendar-date-style) 694 calendar-date-style)
694 (when expected-iso 695 (when expected-iso
695 (setq calendar-date-style 'iso) 696 (setq calendar-date-style 'iso)
@@ -731,10 +732,9 @@ DTSTART;VALUE=DATE-TIME:20030919"
731 "&19/9/2003 non-recurring allday\n" 732 "&19/9/2003 non-recurring allday\n"
732 "&9/19/2003 non-recurring allday\n") 733 "&9/19/2003 non-recurring allday\n")
733 (icalendar-tests--test-import 734 (icalendar-tests--test-import
734 ;; do not remove the trailing blank after "long"! 735 ;; Checkdoc removes trailing blanks. Therefore: format!
735 "SUMMARY:long 736 (format "%s\n%s\n%s" "SUMMARY:long " " summary"
736 summary 737 "DTSTART;VALUE=DATE:20030919")
737DTSTART;VALUE=DATE:20030919"
738 "&2003/9/19 long summary\n" 738 "&2003/9/19 long summary\n"
739 "&19/9/2003 long summary\n" 739 "&19/9/2003 long summary\n"
740 "&9/19/2003 long summary\n") 740 "&9/19/2003 long summary\n")
@@ -752,14 +752,17 @@ DTSTAMP:20031103T011641Z
752 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien 752 "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
753 Status: TENTATIVE 753 Status: TENTATIVE
754 Class: PRIVATE 754 Class: PRIVATE
755 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
755" 756"
756 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien 757 "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
757 Status: TENTATIVE 758 Status: TENTATIVE
758 Class: PRIVATE 759 Class: PRIVATE
760 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
759" 761"
760 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien 762 "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
761 Status: TENTATIVE 763 Status: TENTATIVE
762 Class: PRIVATE 764 Class: PRIVATE
765 UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
763") 766")
764 (icalendar-tests--test-import 767 (icalendar-tests--test-import
765 "UID 768 "UID
@@ -783,13 +786,16 @@ LAST-MODIFIED
783" 786"
784 "&2004/11/23 14:00-14:30 folded summary 787 "&2004/11/23 14:00-14:30 folded summary
785 Status: TENTATIVE 788 Status: TENTATIVE
786 Class: PRIVATE\n" 789 Class: PRIVATE
790 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
787 "&23/11/2004 14:00-14:30 folded summary 791 "&23/11/2004 14:00-14:30 folded summary
788 Status: TENTATIVE 792 Status: TENTATIVE
789 Class: PRIVATE\n" 793 Class: PRIVATE
794 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
790 "&11/23/2004 14:00-14:30 folded summary 795 "&11/23/2004 14:00-14:30 folded summary
791 Status: TENTATIVE 796 Status: TENTATIVE
792 Class: PRIVATE\n") 797 Class: PRIVATE
798 UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
793 799
794 (icalendar-tests--test-import 800 (icalendar-tests--test-import
795 "UID 801 "UID
@@ -811,13 +817,16 @@ DTSTAMP
811" 817"
812 "&2004/11/23 14:45-15:45 another example 818 "&2004/11/23 14:45-15:45 another example
813 Status: TENTATIVE 819 Status: TENTATIVE
814 Class: PRIVATE\n" 820 Class: PRIVATE
821 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
815 "&23/11/2004 14:45-15:45 another example 822 "&23/11/2004 14:45-15:45 another example
816 Status: TENTATIVE 823 Status: TENTATIVE
817 Class: PRIVATE\n" 824 Class: PRIVATE
825 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
818 "&11/23/2004 14:45-15:45 another example 826 "&11/23/2004 14:45-15:45 another example
819 Status: TENTATIVE 827 Status: TENTATIVE
820 Class: PRIVATE\n")) 828 Class: PRIVATE
829 UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
821 830
822(ert-deftest icalendar-import-rrule () 831(ert-deftest icalendar-import-rrule ()
823 (icalendar-tests--test-import 832 (icalendar-tests--test-import
@@ -880,7 +889,6 @@ RRULE:FREQ=MONTHLY;UNTIL=20050819;
880 "DTSTART;VALUE=DATE:20040815 889 "DTSTART;VALUE=DATE:20040815
881DTEND;VALUE=DATE:20040816 890DTEND;VALUE=DATE:20040816
882SUMMARY:Maria Himmelfahrt 891SUMMARY:Maria Himmelfahrt
883UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
884RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8 892RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
885" 893"
886 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n" 894 "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt\n"
@@ -983,11 +991,14 @@ SEQUENCE:1
983CREATED:20041127T183329 991CREATED:20041127T183329
984" 992"
985 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub 993 "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29)) Urlaub
986 Class: PUBLIC\n" 994 Class: PUBLIC
995 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
987 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub 996 "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub
988 Class: PUBLIC\n" 997 Class: PUBLIC
998 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
989 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub 999 "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub
990 Class: PUBLIC\n")) 1000 Class: PUBLIC
1001 UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
991 1002
992(ert-deftest icalendar-import-bug-6766 () 1003(ert-deftest icalendar-import-bug-6766 ()
993 ;;bug#6766 -- multiple byday values in a weekly rrule 1004 ;;bug#6766 -- multiple byday values in a weekly rrule
@@ -1017,20 +1028,26 @@ UID:8814e3f9-7482-408f-996c-3bfe486a1263
1017"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum 1028"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
1018 Status: CONFIRMED 1029 Status: CONFIRMED
1019 Class: PUBLIC 1030 Class: PUBLIC
1031 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1020&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking 1032&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
1021 Class: PUBLIC 1033 Class: PUBLIC
1034 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1022" 1035"
1023"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum 1036"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
1024 Status: CONFIRMED 1037 Status: CONFIRMED
1025 Class: PUBLIC 1038 Class: PUBLIC
1039 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1026&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking 1040&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
1027 Class: PUBLIC 1041 Class: PUBLIC
1042 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1028" 1043"
1029"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum 1044"&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
1030 Status: CONFIRMED 1045 Status: CONFIRMED
1031 Class: PUBLIC 1046 Class: PUBLIC
1047 UID: 8814e3f9-7482-408f-996c-3bfe486a1262
1032&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking 1048&%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
1033 Class: PUBLIC 1049 Class: PUBLIC
1050 UID: 8814e3f9-7482-408f-996c-3bfe486a1263
1034")) 1051"))
1035 1052
1036(ert-deftest icalendar-import-multiple-vcalendars () 1053(ert-deftest icalendar-import-multiple-vcalendars ()
@@ -1075,6 +1092,55 @@ END:VCALENDAR
1075 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n" 1092 "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
1076 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n")) 1093 "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
1077 1094
1095(ert-deftest icalendar-import-with-uid ()
1096 "Perform import test with uid."
1097 (icalendar-tests--test-import
1098 "UID:1234567890uid
1099SUMMARY:non-recurring
1100DTSTART;VALUE=DATE-TIME:20030919T090000
1101DTEND;VALUE=DATE-TIME:20030919T113000"
1102 "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1103 "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
1104 "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
1105
1106(ert-deftest icalendar-import-with-timezone ()
1107 ;; bug#11473
1108 (icalendar-tests--test-import
1109 "BEGIN:VCALENDAR
1110BEGIN:VTIMEZONE
1111TZID:fictional\, nonexistent\, arbitrary
1112BEGIN:STANDARD
1113DTSTART:20100101T000000
1114TZOFFSETFROM:+0200
1115TZOFFSETTO:-0200
1116RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
1117END:STANDARD
1118BEGIN:DAYLIGHT
1119DTSTART:20101201T000000
1120TZOFFSETFROM:-0200
1121TZOFFSETTO:+0200
1122RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
1123END:DAYLIGHT
1124END:VTIMEZONE
1125BEGIN:VEVENT
1126SUMMARY:standardtime
1127DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
1128DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
1129END:VEVENT
1130BEGIN:VEVENT
1131SUMMARY:daylightsavingtime
1132DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
1133DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
1134END:VEVENT
1135END:VCALENDAR"
1136 ;; "standardtime" begins first sunday in january and is 4 hours behind CET
1137 ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
1138 "&2012/1/15 15:00-15:30 standardtime
1139&2012/12/15 11:00-11:30 daylightsavingtime
1140"
1141 nil
1142 nil)
1143 )
1078;; ====================================================================== 1144;; ======================================================================
1079;; Cycle 1145;; Cycle
1080;; ====================================================================== 1146;; ======================================================================
@@ -1090,14 +1156,15 @@ Argument INPUT icalendar event string."
1090 (unless (eq (char-before) ?\n) 1156 (unless (eq (char-before) ?\n)
1091 (insert "\n")) 1157 (insert "\n"))
1092 (insert "END:VEVENT\nEND:VCALENDAR\n")) 1158 (insert "END:VEVENT\nEND:VCALENDAR\n"))
1093 (let ((icalendar-import-format "%s%d%l%o%t%u%c") 1159 (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
1094 (icalendar-import-format-summary "%s") 1160 (icalendar-import-format-summary "%s")
1095 (icalendar-import-format-location "\n Location: %s") 1161 (icalendar-import-format-location "\n Location: %s")
1096 (icalendar-import-format-description "\n Desc: %s") 1162 (icalendar-import-format-description "\n Desc: %s")
1097 (icalendar-import-format-organizer "\n Organizer: %s") 1163 (icalendar-import-format-organizer "\n Organizer: %s")
1098 (icalendar-import-format-status "\n Status: %s") 1164 (icalendar-import-format-status "\n Status: %s")
1099 (icalendar-import-format-url "\n URL: %s") 1165 (icalendar-import-format-url "\n URL: %s")
1100 (icalendar-import-format-class "\n Class: %s")) 1166 (icalendar-import-format-class "\n Class: %s")
1167 (icalendar-import-format-class "\n UID: %s"))
1101 (dolist (calendar-date-style '(iso european american)) 1168 (dolist (calendar-date-style '(iso european american))
1102 (icalendar-tests--do-test-cycle))))) 1169 (icalendar-tests--do-test-cycle)))))
1103 1170
@@ -1121,8 +1188,8 @@ Argument INPUT icalendar event string."
1121 (save-excursion 1188 (save-excursion
1122 (find-file temp-ics) 1189 (find-file temp-ics)
1123 (goto-char (point-min)) 1190 (goto-char (point-min))
1124 (when (re-search-forward "\nUID:.*\n" nil t) 1191 ;;(when (re-search-forward "\nUID:.*\n" nil t)
1125 (replace-match "\n")) 1192 ;;(replace-match "\n"))
1126 (let ((cycled (buffer-substring-no-properties (point-min) (point-max)))) 1193 (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
1127 (should (string= org-input cycled))))) 1194 (should (string= org-input cycled)))))
1128 ;; clean up 1195 ;; clean up
@@ -1135,14 +1202,17 @@ Argument INPUT icalendar event string."
1135 (delete-file temp-ics)))) 1202 (delete-file temp-ics))))
1136 1203
1137(ert-deftest icalendar-cycle () 1204(ert-deftest icalendar-cycle ()
1138 "Perform cycling tests." 1205 "Perform cycling tests.
1206Take care to avoid auto-generated UIDs here."
1139 (icalendar-tests--test-cycle 1207 (icalendar-tests--test-cycle
1140 "DTSTART;VALUE=DATE-TIME:20030919T090000 1208 "UID:dummyuid
1209DTSTART;VALUE=DATE-TIME:20030919T090000
1141DTEND;VALUE=DATE-TIME:20030919T113000 1210DTEND;VALUE=DATE-TIME:20030919T113000
1142SUMMARY:Cycletest 1211SUMMARY:Cycletest
1143") 1212")
1144 (icalendar-tests--test-cycle 1213 (icalendar-tests--test-cycle
1145 "DTSTART;VALUE=DATE-TIME:20030919T090000 1214 "UID:blah
1215DTSTART;VALUE=DATE-TIME:20030919T090000
1146DTEND;VALUE=DATE-TIME:20030919T113000 1216DTEND;VALUE=DATE-TIME:20030919T113000
1147SUMMARY:Cycletest 1217SUMMARY:Cycletest
1148DESCRIPTION:beschreibung! 1218DESCRIPTION:beschreibung!
@@ -1150,7 +1220,8 @@ LOCATION:nowhere
1150ORGANIZER:ulf 1220ORGANIZER:ulf
1151") 1221")
1152 (icalendar-tests--test-cycle 1222 (icalendar-tests--test-cycle
1153 "DTSTART;VALUE=DATE:19190909 1223 "UID:4711
1224DTSTART;VALUE=DATE:19190909
1154DTEND;VALUE=DATE:19190910 1225DTEND;VALUE=DATE:19190910
1155RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09 1226RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
1156SUMMARY:and diary-anniversary 1227SUMMARY:and diary-anniversary
@@ -1223,12 +1294,14 @@ END:VCALENDAR"
1223 Location: Cccc 1294 Location: Cccc
1224 Organizer: MAILTO:aaaaaaa@aaaaaaa.com 1295 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1225 Status: CONFIRMED 1296 Status: CONFIRMED
1297 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1226" 1298"
1227 "&5/9/2003 10:30-15:30 On-Site Interview 1299 "&5/9/2003 10:30-15:30 On-Site Interview
1228 Desc: 10:30am - Blah 1300 Desc: 10:30am - Blah
1229 Location: Cccc 1301 Location: Cccc
1230 Organizer: MAILTO:aaaaaaa@aaaaaaa.com 1302 Organizer: MAILTO:aaaaaaa@aaaaaaa.com
1231 Status: CONFIRMED 1303 Status: CONFIRMED
1304 UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
1232") 1305")
1233 1306
1234 ;; 2003-06-18 a 1307 ;; 2003-06-18 a
@@ -1269,12 +1342,14 @@ END:VALARM"
1269 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below) 1342 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1270 Organizer: MAILTO:xxx@xxxxx.com 1343 Organizer: MAILTO:xxx@xxxxx.com
1271 Status: CONFIRMED 1344 Status: CONFIRMED
1345 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1272" 1346"
1273 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX 1347 "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
1274 Desc: 753 Zeichen hier radiert 1348 Desc: 753 Zeichen hier radiert
1275 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below) 1349 Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
1276 Organizer: MAILTO:xxx@xxxxx.com 1350 Organizer: MAILTO:xxx@xxxxx.com
1277 Status: CONFIRMED 1351 Status: CONFIRMED
1352 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1278") 1353")
1279 ;; 2003-06-18 b -- uses timezone 1354 ;; 2003-06-18 b -- uses timezone
1280 (icalendar-tests--test-import 1355 (icalendar-tests--test-import
@@ -1339,12 +1414,14 @@ END:VCALENDAR"
1339 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below) 1414 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1340 Organizer: MAILTO:bbb@bbbbb.com 1415 Organizer: MAILTO:bbb@bbbbb.com
1341 Status: CONFIRMED 1416 Status: CONFIRMED
1417 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1342" 1418"
1343 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15 1419 "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
1344 Desc: Viele Zeichen standen hier früher 1420 Desc: Viele Zeichen standen hier früher
1345 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below) 1421 Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
1346 Organizer: MAILTO:bbb@bbbbb.com 1422 Organizer: MAILTO:bbb@bbbbb.com
1347 Status: CONFIRMED 1423 Status: CONFIRMED
1424 UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
1348") 1425")
1349 ;; export 2004-10-28 block entries 1426 ;; export 2004-10-28 block entries
1350 (icalendar-tests--test-export 1427 (icalendar-tests--test-export
@@ -1568,8 +1645,6 @@ VERSION
1568PRODID 1645PRODID
1569 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN 1646 :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
1570BEGIN:VEVENT 1647BEGIN:VEVENT
1571UID
1572 :04979712-3902-11d9-93dd-8f9f4afe08da
1573SUMMARY 1648SUMMARY
1574 :Jjjjj & Wwwww 1649 :Jjjjj & Wwwww
1575STATUS 1650STATUS
@@ -1588,8 +1663,6 @@ LAST-MODIFIED
1588 :20041118T013640Z 1663 :20041118T013640Z
1589END:VEVENT 1664END:VEVENT
1590BEGIN:VEVENT 1665BEGIN:VEVENT
1591UID
1592 :6161a312-3902-11d9-b512-f764153bb28b
1593SUMMARY 1666SUMMARY
1594 :BB Aaaaaaaa Bbbbb 1667 :BB Aaaaaaaa Bbbbb
1595STATUS 1668STATUS
@@ -1606,8 +1679,6 @@ DTSTAMP
1606 :20041118T013641Z 1679 :20041118T013641Z
1607END:VEVENT 1680END:VEVENT
1608BEGIN:VEVENT 1681BEGIN:VEVENT
1609UID
1610 :943a4d7e-3902-11d9-9ce7-c9addeadf928
1611SUMMARY 1682SUMMARY
1612 :Hhhhhhhh 1683 :Hhhhhhhh
1613STATUS 1684STATUS
@@ -1624,8 +1695,6 @@ DTSTAMP
1624 :20041118T013831Z 1695 :20041118T013831Z
1625END:VEVENT 1696END:VEVENT
1626BEGIN:VEVENT 1697BEGIN:VEVENT
1627UID
1628 :fe53615e-3902-11d9-9dd8-9d38a155bf41
1629SUMMARY 1698SUMMARY
1630 :MMM Aaaaaaaaa 1699 :MMM Aaaaaaaaa
1631STATUS 1700STATUS
@@ -1646,8 +1715,6 @@ DTSTAMP
1646 :20041118T014117Z 1715 :20041118T014117Z
1647END:VEVENT 1716END:VEVENT
1648BEGIN:VEVENT 1717BEGIN:VEVENT
1649UID
1650 :87c928ee-3901-11d9-b21f-b45042155024
1651SUMMARY 1718SUMMARY
1652 :Rrrr/Cccccc ii Aaaaaaaa 1719 :Rrrr/Cccccc ii Aaaaaaaa
1653DESCRIPTION 1720DESCRIPTION
@@ -1670,8 +1737,6 @@ LAST-MODIFIED
1670 :20041118T014203Z 1737 :20041118T014203Z
1671END:VEVENT 1738END:VEVENT
1672BEGIN:VEVENT 1739BEGIN:VEVENT
1673UID
1674 :e8f331ae-3902-11d9-9948-dfdcb66a2872
1675SUMMARY 1740SUMMARY
1676 :Wwww aa hhhh 1741 :Wwww aa hhhh
1677STATUS 1742STATUS
@@ -1791,11 +1856,13 @@ DTSTAMP
1791 Desc: abcdef 1856 Desc: abcdef
1792 Status: CONFIRMED 1857 Status: CONFIRMED
1793 Class: PRIVATE 1858 Class: PRIVATE
1859 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
1794" 1860"
1795 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day 1861 "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
1796 Desc: abcdef 1862 Desc: abcdef
1797 Status: CONFIRMED 1863 Status: CONFIRMED
1798 Class: PRIVATE 1864 Class: PRIVATE
1865 UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
1799") 1866")
1800 1867
1801 ;; 2005-03-01 lt 1868 ;; 2005-03-01 lt
@@ -1806,8 +1873,10 @@ UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
1806DTSTAMP:20050118T210335Z 1873DTSTAMP:20050118T210335Z
1807DURATION:P7D" 1874DURATION:P7D"
1808 nil 1875 nil
1809 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n" 1876 "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
1810 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n") 1877 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
1878 "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
1879 UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
1811 1880
1812 ;; 2005-03-23 lt 1881 ;; 2005-03-23 lt
1813 (icalendar-tests--test-export 1882 (icalendar-tests--test-export
@@ -1832,7 +1901,72 @@ DTEND;VALUE=DATE:19001102
1832RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1 1901RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
1833SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30 1902SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
1834") 1903")
1835 ) 1904
1905 ;; bug#11473
1906 (icalendar-tests--test-import
1907 "BEGIN:VCALENDAR
1908METHOD:REQUEST
1909PRODID:Microsoft Exchange Server 2007
1910VERSION:2.0
1911BEGIN:VTIMEZONE
1912TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna
1913BEGIN:STANDARD
1914DTSTART:16010101T030000
1915TZOFFSETFROM:+0200
1916TZOFFSETTO:+0100
1917RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
1918END:STANDARD
1919BEGIN:DAYLIGHT
1920DTSTART:16010101T020000
1921TZOFFSETFROM:+0100
1922TZOFFSETTO:+0200
1923RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
1924END:DAYLIGHT
1925END:VTIMEZONE
1926BEGIN:VEVENT
1927ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
1928ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
1929 er\":MAILTO:other.luser@foo.com
1930DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
1931SUMMARY;LANGUAGE=en-US:Query
1932DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
1933 :20120515T150000
1934DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
1935 0120515T153000
1936UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
1937 010000000575268034ECDB649A15349B1BF240F15
1938RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
1939 ienna\":20120515T170000
1940CLASS:PUBLIC
1941PRIORITY:5
1942DTSTAMP:20120514T153645Z
1943TRANSP:OPAQUE
1944STATUS:CONFIRMED
1945SEQUENCE:15
1946LOCATION;LANGUAGE=en-US:phone
1947X-MICROSOFT-CDO-APPT-SEQUENCE:15
1948X-MICROSOFT-CDO-OWNERAPPTID:1907632092
1949X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
1950X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
1951X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
1952X-MICROSOFT-CDO-IMPORTANCE:1
1953X-MICROSOFT-CDO-INSTTYPE:3
1954BEGIN:VALARM
1955ACTION:DISPLAY
1956DESCRIPTION:REMINDER
1957TRIGGER;RELATED=START:-PT15M
1958END:VALARM
1959END:VEVENT
1960END:VCALENDAR"
1961 nil
1962 "&15/5/2012 15:00-15:30 Query
1963 Location: phone
1964 Organizer: MAILTO:a.luser@foo.com
1965 Status: CONFIRMED
1966 Class: PUBLIC
1967 UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
1968" nil)
1969)
1836 1970
1837(provide 'icalendar-tests) 1971(provide 'icalendar-tests)
1838;;; icalendar-tests.el ends here 1972;;; icalendar-tests.el ends here
diff --git a/test/automated/lexbind-tests.el b/test/automated/lexbind-tests.el
index 95b8bbe8858..22668bc7d02 100644
--- a/test/automated/lexbind-tests.el
+++ b/test/automated/lexbind-tests.el
@@ -1,6 +1,6 @@
1;;; lexbind-tests.el --- Testing the lexbind byte-compiler 1;;; lexbind-tests.el --- Testing the lexbind byte-compiler
2 2
3;; Copyright (C) 2011 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@iro.umontreal.ca> 5;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
6;; Keywords: 6;; Keywords:
diff --git a/test/automated/newsticker-tests.el b/test/automated/newsticker-tests.el
index 76f4345da55..5b60535e463 100644
--- a/test/automated/newsticker-tests.el
+++ b/test/automated/newsticker-tests.el
@@ -1,6 +1,6 @@
1;;; newsticker-testsuite.el --- Test suite for newsticker. 1;;; newsticker-testsuite.el --- Test suite for newsticker.
2 2
3;; Copyright (C) 2003-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2003-2012 Free Software Foundation, Inc.
4 4
5;; Author: Ulf Jasper <ulf.jasper@web.de> 5;; Author: Ulf Jasper <ulf.jasper@web.de>
6;; Keywords: News, RSS, Atom 6;; Keywords: News, RSS, Atom
diff --git a/test/automated/occur-tests.el b/test/automated/occur-tests.el
index 2ae5b1c132f..5fe9722d4e7 100644
--- a/test/automated/occur-tests.el
+++ b/test/automated/occur-tests.el
@@ -1,6 +1,6 @@
1;;; occur-tests.el --- Test suite for occur. 1;;; occur-tests.el --- Test suite for occur.
2 2
3;; Copyright (C) 2010-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 4
5;; Author: Juri Linkov <juri@jurta.org> 5;; Author: Juri Linkov <juri@jurta.org>
6;; Keywords: matching, internal 6;; Keywords: matching, internal
@@ -35,7 +35,7 @@ xd
35xex 35xex
36fx 36fx
37" "\ 37" "\
385 matches for \"x\" in buffer: *temp*<2> 385 matches for \"x\" in buffer: *test-occur*
39 1:xa 39 1:xa
40 3:cx 40 3:cx
41 4:xd 41 4:xd
@@ -52,7 +52,7 @@ a
52a 52a
53a 53a
54" "\ 54" "\
552 matches for \"a^Ja\" in buffer: *temp*<2> 552 matches for \"a^Ja\" in buffer: *test-occur*
56 1:a 56 1:a
57 :a 57 :a
58 3:a 58 3:a
@@ -68,7 +68,7 @@ c
68a 68a
69b 69b
70" "\ 70" "\
712 matches for \"a^Jb\" in buffer: *temp*<2> 712 matches for \"a^Jb\" in buffer: *test-occur*
72 1:a 72 1:a
73 :b 73 :b
74 4:a 74 4:a
@@ -82,7 +82,7 @@ c
82a 82a
83 83
84" "\ 84" "\
852 matches for \"a^J\" in buffer: *temp*<2> 852 matches for \"a^J\" in buffer: *test-occur*
86 1:a 86 1:a
87 : 87 :
88 4:a 88 4:a
@@ -97,7 +97,7 @@ d
97ex 97ex
98fx 98fx
99" "\ 99" "\
1002 matches for \"x^J.x^J\" in buffer: *temp*<2> 1002 matches for \"x^J.x^J\" in buffer: *test-occur*
101 1:ax 101 1:ax
102 :bx 102 :bx
103 :c 103 :c
@@ -116,7 +116,7 @@ f
116g 116g
117hx 117hx
118" "\ 118" "\
1193 matches for \"x\" in buffer: *temp*<2> 1193 matches for \"x\" in buffer: *test-occur*
120 1:ax 120 1:ax
121 :b 121 :b
122------- 122-------
@@ -136,7 +136,7 @@ d
136ex 136ex
137f 137f
138" "\ 138" "\
1392 matches for \"x\" in buffer: *temp*<2> 1392 matches for \"x\" in buffer: *test-occur*
140 :a 140 :a
141 2:bx 141 2:bx
142 :c 142 :c
@@ -159,7 +159,7 @@ i
159j 159j
160kx 160kx
161" "\ 161" "\
1625 matches for \"x\" in buffer: *temp*<2> 1625 matches for \"x\" in buffer: *test-occur*
163 1:ax 163 1:ax
164 2:bx 164 2:bx
165 :c 165 :c
@@ -184,7 +184,7 @@ gx
184h 184h
185i 185i
186" "\ 186" "\
1872 matches for \"x\" in buffer: *temp*<2> 1872 matches for \"x\" in buffer: *test-occur*
188 :a 188 :a
189 :b 189 :b
190 3:cx 190 3:cx
@@ -207,7 +207,7 @@ gx
207h 207h
208 208
209" "\ 209" "\
2102 matches for \"x\" in buffer: *temp*<2> 2102 matches for \"x\" in buffer: *test-occur*
211 : 211 :
212 :b 212 :b
213 3:cx 213 3:cx
@@ -232,7 +232,7 @@ i
232jx 232jx
233kx 233kx
234" "\ 234" "\
2353 matches for \"x^J.x\" in buffer: *temp*<2> 2353 matches for \"x^J.x\" in buffer: *test-occur*
236 1:ax 236 1:ax
237 :bx 237 :bx
238 :c 238 :c
@@ -256,7 +256,7 @@ f
256gx 256gx
257hx 257hx
258" "\ 258" "\
2592 matches for \"x^J.x\" in buffer: *temp*<2> 2592 matches for \"x^J.x\" in buffer: *test-occur*
260 1:ax 260 1:ax
261 :bx 261 :bx
262 :c 262 :c
@@ -279,7 +279,7 @@ g
279h 279h
280ix 280ix
281" "\ 281" "\
2823 matches for \"x\" in buffer: *temp*<2> 2823 matches for \"x\" in buffer: *test-occur*
283 :a 283 :a
284 2:bx 284 2:bx
285------- 285-------
@@ -302,7 +302,7 @@ f
302gx 302gx
303h 303h
304" "\ 304" "\
3053 matches for \"x\" in buffer: *temp*<2> 3053 matches for \"x\" in buffer: *test-occur*
306 :a 306 :a
307 2:bx 307 2:bx
308 :c 308 :c
@@ -321,14 +321,19 @@ Each element has the format:
321 (let ((regexp (nth 0 test)) 321 (let ((regexp (nth 0 test))
322 (nlines (nth 1 test)) 322 (nlines (nth 1 test))
323 (input-buffer-string (nth 2 test)) 323 (input-buffer-string (nth 2 test))
324 (output-buffer-string (nth 3 test))) 324 (output-buffer-string (nth 3 test))
325 (save-window-excursion 325 (temp-buffer (get-buffer-create " *test-occur*")))
326 (with-temp-buffer 326 (unwind-protect
327 (insert input-buffer-string) 327 (save-window-excursion
328 (occur regexp nlines) 328 (with-current-buffer temp-buffer
329 (equal output-buffer-string 329 (erase-buffer)
330 (with-current-buffer "*Occur*" 330 (insert input-buffer-string)
331 (buffer-string))))))) 331 (occur regexp nlines)
332 (equal output-buffer-string
333 (with-current-buffer "*Occur*"
334 (buffer-string)))))
335 (and (buffer-name temp-buffer)
336 (kill-buffer temp-buffer)))))
332 337
333(ert-deftest occur-tests () 338(ert-deftest occur-tests ()
334 "Test the functionality of `occur'. 339 "Test the functionality of `occur'.
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el
new file mode 100644
index 00000000000..ad48413b030
--- /dev/null
+++ b/test/automated/ruby-mode-tests.el
@@ -0,0 +1,365 @@
1;;; ruby-mode-tests.el --- Test suite for ruby-mode
2
3;; Copyright (C) 2012 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 'ruby-mode)
25
26(defun ruby-should-indent (content column)
27 "Assert indentation COLUMN on the last line of CONTENT."
28 (with-temp-buffer
29 (insert content)
30 (ruby-mode)
31 (ruby-indent-line)
32 (should (= (current-indentation) column))))
33
34(defun ruby-should-indent-buffer (expected content)
35 "Assert that CONTENT turns into EXPECTED after the buffer is re-indented.
36
37The whitespace before and including \"|\" on each line is removed."
38 (with-temp-buffer
39 (insert (ruby-test-string content))
40 (ruby-mode)
41 (indent-region (point-min) (point-max))
42 (should (string= (ruby-test-string expected) (buffer-string)))))
43
44(defun ruby-test-string (s &rest args)
45 (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args))
46
47(defun ruby-assert-state (content &rest values-plist)
48 "Assert syntax state values at the end of CONTENT.
49
50VALUES-PLIST is a list with alternating index and value elements."
51 (with-temp-buffer
52 (insert content)
53 (ruby-mode)
54 (syntax-propertize (point))
55 (while values-plist
56 (should (eq (nth (car values-plist)
57 (parse-partial-sexp (point-min) (point)))
58 (cadr values-plist)))
59 (setq values-plist (cddr values-plist)))))
60
61(defun ruby-assert-face (content pos face)
62 (with-temp-buffer
63 (insert content)
64 (ruby-mode)
65 (font-lock-fontify-buffer)
66 (should (eq face (get-text-property pos 'face)))))
67
68(ert-deftest ruby-indent-after-symbol-made-from-string-interpolation ()
69 "It can indent the line after symbol made using string interpolation."
70 (ruby-should-indent "def foo(suffix)\n :\"bar#{suffix}\"\n"
71 ruby-indent-level))
72
73(ert-deftest ruby-indent-after-js-style-symbol-with-block-beg-name ()
74 "JS-style hash symbol can have keyword name."
75 (ruby-should-indent "link_to \"home\", home_path, class: \"foo\"\n" 0))
76
77(ert-deftest ruby-discern-singleton-class-from-heredoc ()
78 (ruby-assert-state "foo <<asd\n" 3 ?\n)
79 (ruby-assert-state "class <<asd\n" 3 nil))
80
81(ert-deftest ruby-heredoc-font-lock ()
82 (let ((s "foo <<eos.gsub('^ *', '')"))
83 (ruby-assert-face s 9 font-lock-string-face)
84 (ruby-assert-face s 10 nil)))
85
86(ert-deftest ruby-singleton-class-no-heredoc-font-lock ()
87 (ruby-assert-face "class<<a" 8 nil))
88
89(ert-deftest ruby-deep-indent ()
90 (let ((ruby-deep-arglist nil)
91 (ruby-deep-indent-paren '(?\( ?\{ ?\[ ?\] t)))
92 (ruby-should-indent "foo = [1,\n2" 7)
93 (ruby-should-indent "foo = {a: b,\nc: d" 7)
94 (ruby-should-indent "foo(a,\nb" 4)))
95
96(ert-deftest ruby-deep-indent-disabled ()
97 (let ((ruby-deep-arglist nil)
98 (ruby-deep-indent-paren nil))
99 (ruby-should-indent "foo = [\n1" ruby-indent-level)
100 (ruby-should-indent "foo = {\na: b" ruby-indent-level)
101 (ruby-should-indent "foo(\na" ruby-indent-level)))
102
103(ert-deftest ruby-indent-after-keyword-in-a-string ()
104 (ruby-should-indent "a = \"abc\nif\"\n " 0)
105 (ruby-should-indent "a = %w[abc\n def]\n " 0)
106 (ruby-should-indent "a = \"abc\n def\"\n " 0))
107
108(ert-deftest ruby-indent-simple ()
109 (ruby-should-indent-buffer
110 "if foo
111 | bar
112 |end
113 |zot
114 |"
115 "if foo
116 |bar
117 | end
118 | zot
119 |"))
120
121(ert-deftest ruby-indent-keyword-label ()
122 (ruby-should-indent-buffer
123 "bar(class: XXX) do
124 | foo
125 |end
126 |bar
127 |"
128 "bar(class: XXX) do
129 | foo
130 | end
131 | bar
132 |"))
133
134(ert-deftest ruby-indent-method-with-question-mark ()
135 (ruby-should-indent-buffer
136 "if x.is_a?(XXX)
137 | foo
138 |end
139 |"
140 "if x.is_a?(XXX)
141 | foo
142 | end
143 |"))
144
145(ert-deftest ruby-indent-expr-in-regexp ()
146 (ruby-should-indent-buffer
147 "if /#{foo}/ =~ s
148 | x = 1
149 |end
150 |"
151 "if /#{foo}/ =~ s
152 | x = 1
153 | end
154 |"))
155
156(ert-deftest ruby-indent-singleton-class ()
157 (ruby-should-indent-buffer
158 "class<<bar
159 | foo
160 |end
161 |"
162 "class<<bar
163 |foo
164 | end
165 |"))
166
167(ert-deftest ruby-indent-inside-heredoc-after-operator ()
168 (ruby-should-indent-buffer
169 "b=<<eos
170 | 42"
171 "b=<<eos
172 | 42"))
173
174(ert-deftest ruby-indent-inside-heredoc-after-space ()
175 (ruby-should-indent-buffer
176 "foo <<eos.gsub(' ', '*')
177 | 42"
178 "foo <<eos.gsub(' ', '*')
179 | 42"))
180
181(ert-deftest ruby-indent-array-literal ()
182 (let ((ruby-deep-indent-paren nil))
183 (ruby-should-indent-buffer
184 "foo = [
185 | bar
186 |]
187 |"
188 "foo = [
189 | bar
190 | ]
191 |"))
192 (ruby-should-indent-buffer
193 "foo do
194 | [bar]
195 |end
196 |"
197 "foo do
198 |[bar]
199 | end
200 |"))
201
202(ert-deftest ruby-indent-begin-end ()
203 (ruby-should-indent-buffer
204 "begin
205 | a[b]
206 |end
207 |"
208 "begin
209 | a[b]
210 | end
211 |"))
212
213(ert-deftest ruby-indent-array-after-paren-and-space ()
214 (ruby-should-indent-buffer
215 "class A
216 | def foo
217 | foo( [])
218 | end
219 |end
220 |"
221 "class A
222 | def foo
223 |foo( [])
224 |end
225 | end
226 |"))
227
228(ert-deftest ruby-move-to-block-stops-at-indentation ()
229 (with-temp-buffer
230 (insert "def f\nend")
231 (beginning-of-line)
232 (ruby-mode)
233 (ruby-move-to-block -1)
234 (should (looking-at "^def"))))
235
236(ert-deftest ruby-toggle-block-to-do-end ()
237 (with-temp-buffer
238 (insert "foo {|b|\n}")
239 (ruby-mode)
240 (beginning-of-line)
241 (ruby-toggle-block)
242 (should (string= "foo do |b|\nend" (buffer-string)))))
243
244(ert-deftest ruby-toggle-block-to-brace ()
245 (let ((pairs '((16 . "foo {|b| b + 2 }")
246 (15 . "foo {|b|\n b + 2\n}"))))
247 (dolist (pair pairs)
248 (with-temp-buffer
249 (let ((fill-column (car pair)))
250 (insert "foo do |b|\n b + 2\nend")
251 (ruby-mode)
252 (beginning-of-line)
253 (ruby-toggle-block)
254 (should (string= (cdr pair) (buffer-string))))))))
255
256(ert-deftest ruby-toggle-block-to-multiline ()
257 (with-temp-buffer
258 (insert "foo {|b| b + 1}")
259 (ruby-mode)
260 (beginning-of-line)
261 (ruby-toggle-block)
262 (should (string= "foo do |b|\n b + 1\nend" (buffer-string)))))
263
264(ert-deftest ruby-recognize-symbols-starting-with-at-character ()
265 (ruby-assert-face ":@abc" 3 font-lock-constant-face))
266
267(ert-deftest ruby-hash-character-not-interpolation ()
268 (ruby-assert-face "\"This is #{interpolation}\"" 15
269 font-lock-variable-name-face)
270 (ruby-assert-face "\"This is \\#{no interpolation} despite the #\""
271 15 font-lock-string-face)
272 (ruby-assert-face "\n#@comment, not ruby code" 5 font-lock-comment-face)
273 (ruby-assert-state "\n#@comment, not ruby code" 4 t)
274 (ruby-assert-face "# A comment cannot have #{an interpolation} in it"
275 30 font-lock-comment-face)
276 (ruby-assert-face "# #{comment}\n \"#{interpolation}\"" 16
277 font-lock-variable-name-face))
278
279(ert-deftest ruby-interpolation-suppresses-syntax-inside ()
280 (let ((s "\"<ul><li>#{@files.join(\"</li><li>\")}</li></ul>\""))
281 (ruby-assert-state s 8 nil)
282 (ruby-assert-face s 9 font-lock-string-face)
283 (ruby-assert-face s 10 font-lock-variable-name-face)
284 (ruby-assert-face s 41 font-lock-string-face)))
285
286(ert-deftest ruby-interpolation-inside-percent-literal-with-paren ()
287 :expected-result :failed
288 (let ((s "%(^#{\")\"}^)"))
289 (ruby-assert-face s 3 font-lock-string-face)
290 (ruby-assert-face s 4 font-lock-variable-name-face)
291 (ruby-assert-face s 10 font-lock-string-face)
292 ;; It's confused by the closing paren in the middle.
293 (ruby-assert-state s 8 nil)))
294
295(ert-deftest ruby-add-log-current-method-examples ()
296 (let ((pairs '(("foo" . "#foo")
297 ("C.foo" . ".foo")
298 ("self.foo" . ".foo"))))
299 (loop for (name . value) in pairs
300 do (with-temp-buffer
301 (insert (ruby-test-string
302 "module M
303 | class C
304 | def %s
305 | end
306 | end
307 |end"
308 name))
309 (ruby-mode)
310 (search-backward "def")
311 (forward-line)
312 (should (string= (ruby-add-log-current-method)
313 (format "M::C%s" value)))))))
314
315(defvar ruby-block-test-example
316 (ruby-test-string
317 "class C
318 | def foo
319 | 1
320 | end
321 |
322 | def bar
323 | 2
324 | end
325 |
326 | def baz
327 | some do
328 | end
329 | end
330 |end"))
331
332(defmacro ruby-deftest-move-to-block (name &rest body)
333 `(ert-deftest ,(intern (format "ruby-move-to-block-%s" name)) ()
334 (with-temp-buffer
335 (insert ruby-block-test-example)
336 (ruby-mode)
337 ,@body)))
338
339(put 'ruby-deftest-move-to-block 'lisp-indent-function 'defun)
340
341(ruby-deftest-move-to-block works-on-do
342 (goto-line 11)
343 (ruby-end-of-block)
344 (should (= 12 (line-number-at-pos)))
345 (ruby-beginning-of-block)
346 (should (= 11 (line-number-at-pos))))
347
348(ruby-deftest-move-to-block zero-is-noop
349 (goto-line 5)
350 (ruby-move-to-block 0)
351 (should (= 5 (line-number-at-pos))))
352
353(ruby-deftest-move-to-block ok-with-three
354 (goto-line 2)
355 (ruby-move-to-block 3)
356 (should (= 13 (line-number-at-pos))))
357
358(ruby-deftest-move-to-block ok-with-minus-two
359 (goto-line 10)
360 (ruby-move-to-block -2)
361 (should (= 2 (line-number-at-pos))))
362
363(provide 'ruby-mode-tests)
364
365;;; ruby-mode-tests.el ends here
diff --git a/test/automated/url-future-tests.el b/test/automated/url-future-tests.el
new file mode 100644
index 00000000000..d499da6dbe2
--- /dev/null
+++ b/test/automated/url-future-tests.el
@@ -0,0 +1,57 @@
1;;; url-future-tests.el --- Test suite for url-future.
2
3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4
5;; Author: Teodor Zlatanov <tzz@lifelogs.com>
6;; Keywords: data
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Code:
24
25(require 'ert)
26(require 'url-future)
27
28(ert-deftest url-future-tests ()
29 (let* (saver
30 (text "running future")
31 (good (make-url-future :value (lambda () (format text))
32 :callback (lambda (f) (set 'saver f))))
33 (bad (make-url-future :value (lambda () (/ 1 0))
34 :errorback (lambda (&rest d) (set 'saver d))))
35 (tocancel (make-url-future :value (lambda () (/ 1 0))
36 :callback (lambda (f) (set 'saver f))
37 :errorback (lambda (&rest d)
38 (set 'saver d)))))
39 (should (equal good (url-future-call good)))
40 (should (equal good saver))
41 (should (equal text (url-future-value good)))
42 (should (url-future-completed-p good))
43 (should-error (url-future-call good))
44 (setq saver nil)
45 (should (equal bad (url-future-call bad)))
46 (should-error (url-future-call bad))
47 (should (equal saver (list bad '(arith-error))))
48 (should (url-future-errored-p bad))
49 (setq saver nil)
50 (should (equal (url-future-cancel tocancel) tocancel))
51 (should-error (url-future-call tocancel))
52 (should (null saver))
53 (should (url-future-cancelled-p tocancel))))
54
55(provide 'url-future-tests)
56
57;;; url-future-tests.el ends here
diff --git a/test/automated/url-util-tests.el b/test/automated/url-util-tests.el
new file mode 100644
index 00000000000..65eb37ce926
--- /dev/null
+++ b/test/automated/url-util-tests.el
@@ -0,0 +1,51 @@
1;;; url-util-tests.el --- Test suite for url-util.
2
3;; Copyright (C) 2012 Free Software Foundation, Inc.
4
5;; Author: Teodor Zlatanov <tzz@lifelogs.com>
6;; Keywords: data
7
8;; This file is part of GNU Emacs.
9
10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation, either version 3 of the License, or
13;; (at your option) any later version.
14
15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details.
19
20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22
23;;; Code:
24
25(require 'ert)
26(require 'url-util)
27
28(ert-deftest url-util-tests ()
29 (let ((tests
30 '(("key1=val1&key2=val2&key3=val1&key3=val2&key4&key5"
31 ((key1 val1) (key2 "val2") (key3 val1 val2) (key4) (key5 "")))
32 ("key1=val1;key2=val2;key3=val1;key3=val2;key4;key5"
33 ((key1 "val1") (key2 val2) (key3 val1 val2) ("key4") (key5 "")) t)
34 ("key1=val1;key2=val2;key3=val1;key3=val2;key4=;key5="
35 ((key1 val1) (key2 val2) ("key3" val1 val2) (key4) (key5 "")) t t)))
36 test)
37 (while tests
38 (setq test (car tests)
39 tests (cdr tests))
40 (should (equal (apply 'url-build-query-string (cdr test)) (car test)))))
41 (should (equal (url-parse-query-string
42 "key1=val1&key2=val2&key3=val1&key3=val2&key4=&key5")
43 '(("key5" "")
44 ("key4" "")
45 ("key3" "val2" "val1")
46 ("key2" "val2")
47 ("key1" "val1")))))
48
49(provide 'url-util-tests)
50
51;;; url-util-tests.el ends here
diff --git a/test/automated/vc-bzr.el b/test/automated/vc-bzr.el
index b2cbda4d669..94f8502b882 100644
--- a/test/automated/vc-bzr.el
+++ b/test/automated/vc-bzr.el
@@ -1,6 +1,6 @@
1;;; vc-bzr.el --- tests for vc/vc-bzr.el 1;;; vc-bzr.el --- tests for vc/vc-bzr.el
2 2
3;; Copyright (C) 2011 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Glenn Morris <rgm@gnu.org> 5;; Author: Glenn Morris <rgm@gnu.org>
6 6
@@ -98,4 +98,31 @@
98 (should (get-buffer "*vc-log*"))) 98 (should (get-buffer "*vc-log*")))
99 (delete-directory tempdir t)))) 99 (delete-directory tempdir t))))
100 100
101;; http://lists.gnu.org/archive/html/help-gnu-emacs/2012-04/msg00145.html
102(ert-deftest vc-bzr-test-faulty-bzr-autoloads ()
103 "Test we can generate autoloads in a bzr directory when bzr is faulty."
104 :expected-result (if (executable-find vc-bzr-program) :passed :failed)
105 (should (executable-find vc-bzr-program))
106 (let* ((tempdir (make-temp-file "vc-bzr-test" t))
107 (file (expand-file-name "foo.el" tempdir))
108 (default-directory (file-name-as-directory tempdir))
109 (generated-autoload-file (expand-file-name "loaddefs.el" tempdir)))
110 (unwind-protect
111 (progn
112 (call-process vc-bzr-program nil nil nil "init")
113 (with-temp-buffer
114 (insert ";;;###autoload
115\(defun foo () \"foo\" (interactive) (message \"foo!\"))")
116 (write-region nil nil file nil 'silent))
117 (call-process vc-bzr-program nil nil nil "add")
118 (call-process vc-bzr-program nil nil nil "commit" "-m" "Commit 1")
119 ;; Deleting dirstate ensures both that vc-bzr's status heuristic
120 ;; fails, so it has to call the external bzr status, and
121 ;; causes bzr status to fail. This simulates a broken bzr
122 ;; installation.
123 (delete-file ".bzr/checkout/dirstate")
124 (should (progn (update-directory-autoloads default-directory)
125 t)))
126 (delete-directory tempdir t))))
127
101;;; vc-bzr.el ends here 128;;; vc-bzr.el ends here
diff --git a/test/automated/xml-parse-tests.el b/test/automated/xml-parse-tests.el
new file mode 100644
index 00000000000..35009ed36a2
--- /dev/null
+++ b/test/automated/xml-parse-tests.el
@@ -0,0 +1,135 @@
1;;; xml-parse-tests.el --- Test suite for XML parsing.
2
3;; Copyright (C) 2012 Free Software Foundation, Inc.
4
5;; Author: Chong Yidong <cyd@stupidchicken.com>
6;; Keywords: internal
7;; Human-Keywords: internal
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
13;; the Free Software Foundation, either version 3 of the License, or
14;; (at your option) any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
23
24;;; Commentary:
25
26;; Type M-x test-xml-parse RET to generate the test buffer.
27
28;;; Code:
29
30(require 'xml)
31
32(defvar xml-parse-tests--data
33 `(;; General entity substitution
34 ("<?xml version=\"1.0\"?><!DOCTYPE foo SYSTEM \"bar.dtd\" [<!ENTITY ent \"AbC\">]><foo a=\"b\"><bar>&ent;;</bar></foo>" .
35 ((foo ((a . "b")) (bar nil "AbC;"))))
36 ("<?xml version=\"1.0\"?><foo>&amp;amp;&#x26;apos;&apos;&lt;&gt;&quot;</foo>" .
37 ((foo () "&amp;&apos;'<>\"")))
38 ;; Parameter entity substitution
39 ("<?xml version=\"1.0\"?><!DOCTYPE foo SYSTEM \"bar.dtd\" [<!ENTITY % pent \"AbC\"><!ENTITY ent \"%pent;\">]><foo a=\"b\"><bar>&ent;;</bar></foo>" .
40 ((foo ((a . "b")) (bar nil "AbC;"))))
41 ;; Tricky parameter entity substitution (like XML spec Appendix D)
42 ("<?xml version='1.0'?><!DOCTYPE foo [ <!ENTITY % xx '&#37;zz;'><!ENTITY % zz '&#60;!ENTITY ent \"b\" >' > %xx; ]><foo>A&ent;C</foo>" .
43 ((foo () "AbC")))
44 ;; Bug#7172
45 ("<?xml version=\"1.0\"?><!DOCTYPE foo [ <!ELEMENT EXAM_PLE EMPTY> ]><foo></foo>" .
46 ((foo ())))
47 ;; Entities referencing entities, in character data
48 ("<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">]><foo>&abc;</foo>" .
49 ((foo () "aBc")))
50 ;; Entities referencing entities, in attribute values
51 ("<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">]><foo a=\"-&abc;-\">1</foo>" .
52 ((foo ((a . "-aBc-")) "1")))
53 ;; Character references must be treated as character data
54 ("<foo>AT&amp;T;</foo>" . ((foo () "AT&T;")))
55 ("<foo>&#38;amp;</foo>" . ((foo () "&amp;")))
56 ("<foo>&#x26;amp;</foo>" . ((foo () "&amp;")))
57 ;; Unusual but valid XML names [5]
58 ("<ÀÖØö.3·-‿⁀󯿿>abc</ÀÖØö.3·-‿⁀󯿿>" . ((,(intern "ÀÖØö.3·-‿⁀󯿿") () "abc")))
59 ("<:>abc</:>" . ((,(intern ":") () "abc"))))
60 "Alist of XML strings and their expected parse trees.")
61
62(defvar xml-parse-tests--bad-data
63 '(;; XML bomb in content
64 "<!DOCTYPE foo [<!ENTITY lol \"lol\"><!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\"><!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">]><foo>&lol2;</foo>"
65 ;; XML bomb in attribute value
66 "<!DOCTYPE foo [<!ENTITY lol \"lol\"><!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\"><!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">]><foo a=\"&lol2;\">!</foo>"
67 ;; Non-terminating DTD
68 "<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">"
69 "<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">asdf"
70 "<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">asdf&abc;"
71 ;; Invalid XML names
72 "<0foo>abc</0foo>"
73 "<‿foo>abc</‿foo>"
74 "<f¿>abc</f¿>")
75 "List of XML strings that should signal an error in the parser")
76
77(defvar xml-parse-tests--qnames
78 '( ;; Test data for name expansion
79 ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><D:multistatus xmlns:D=\"DAV:\"><D:response><D:href>/calendar/events/</D:href><D:propstat><D:status>HTTP/1.1 200 OK</D:status></D:propstat></D:response></D:multistatus>"
80 ;; Result with qnames as cons
81 ((("DAV:" . "multistatus")
82 ((("http://www.w3.org/2000/xmlns/" . "D") . "DAV:"))
83 (("DAV:" . "response") nil (("DAV:" . "href") nil "/calendar/events/")
84 (("DAV:" . "propstat") nil (("DAV:" . "status") nil "HTTP/1.1 200 OK")))))
85 ;; Result with qnames as symbols
86 ((DAV:multistatus
87 ((("http://www.w3.org/2000/xmlns/" . "D") . "DAV:"))
88 (DAV:response nil (DAV:href nil "/calendar/events/")
89 (DAV:propstat nil (DAV:status nil "HTTP/1.1 200 OK"))))))
90 ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><F:something>hi there</F:something>"
91 ((("FOOBAR:" . "something") nil "hi there"))
92 ((FOOBAR:something nil "hi there"))))
93 "List of strings which are parsed using namespace expansion.
94Parser is called with and without 'symbol-qnames argument.")
95
96(ert-deftest xml-parse-tests ()
97 "Test XML parsing."
98 (with-temp-buffer
99 (dolist (test xml-parse-tests--data)
100 (erase-buffer)
101 (insert (car test))
102 (should (equal (cdr test) (xml-parse-region))))
103 (let ((xml-entity-expansion-limit 50))
104 (dolist (test xml-parse-tests--bad-data)
105 (erase-buffer)
106 (insert test)
107 (should-error (xml-parse-region))))
108 (let ((testdata (car xml-parse-tests--qnames)))
109 (erase-buffer)
110 (insert (car testdata))
111 (should (equal (nth 1 testdata)
112 (xml-parse-region nil nil nil nil t)))
113 (should (equal (nth 2 testdata)
114 (xml-parse-region nil nil nil nil 'symbol-qnames))))
115 (let ((testdata (nth 1 xml-parse-tests--qnames)))
116 (erase-buffer)
117 (insert (car testdata))
118 ;; Provide additional namespace-URI mapping
119 (should (equal (nth 1 testdata)
120 (xml-parse-region
121 nil nil nil nil
122 (append xml-default-ns
123 '(("F" . "FOOBAR:"))))))
124 (should (equal (nth 2 testdata)
125 (xml-parse-region
126 nil nil nil nil
127 (cons 'symbol-qnames
128 (append xml-default-ns
129 '(("F" . "FOOBAR:"))))))))))
130
131;; Local Variables:
132;; no-byte-compile: t
133;; End:
134
135;;; xml-parse-tests.el ends here.
diff --git a/test/cedet/cedet-utests.el b/test/cedet/cedet-utests.el
index f7eef05dd99..f5df51dc4c9 100644
--- a/test/cedet/cedet-utests.el
+++ b/test/cedet/cedet-utests.el
@@ -1,6 +1,6 @@
1;;; cedet-utests.el --- Run all unit tests in the CEDET suite. 1;;; cedet-utests.el --- Run all unit tests in the CEDET suite.
2 2
3;; Copyright (C) 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <eric@siege-engine.com> 5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/ede-tests.el b/test/cedet/ede-tests.el
index f07098a8a9a..f73e4bed63f 100644
--- a/test/cedet/ede-tests.el
+++ b/test/cedet/ede-tests.el
@@ -1,6 +1,6 @@
1;;; ede-tests.el --- Some tests for the Emacs Development Environment 1;;; ede-tests.el --- Some tests for the Emacs Development Environment
2 2
3;; Copyright (C) 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <eric@siege-engine.com> 5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/semantic-ia-utest.el b/test/cedet/semantic-ia-utest.el
index 765029151dc..c523e103669 100644
--- a/test/cedet/semantic-ia-utest.el
+++ b/test/cedet/semantic-ia-utest.el
@@ -1,6 +1,6 @@
1;;; semantic-ia-utest.el --- Analyzer unit tests 1;;; semantic-ia-utest.el --- Analyzer unit tests
2 2
3;; Copyright (C) 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <eric@siege-engine.com> 5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/semantic-tests.el b/test/cedet/semantic-tests.el
index 16dcd42c2ae..22b959016c1 100644
--- a/test/cedet/semantic-tests.el
+++ b/test/cedet/semantic-tests.el
@@ -1,6 +1,6 @@
1;;; semantic-utest.el --- Miscellaneous Semantic tests. 1;;; semantic-utest.el --- Miscellaneous Semantic tests.
2 2
3;;; Copyright (C) 2003-2004, 2007-2011 Free Software Foundation, Inc. 3;;; Copyright (C) 2003-2004, 2007-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <zappo@gnu.org> 5;; Author: Eric M. Ludlam <zappo@gnu.org>
6 6
diff --git a/test/cedet/semantic-utest-c.el b/test/cedet/semantic-utest-c.el
index 3fbd180290c..c500f543187 100644
--- a/test/cedet/semantic-utest-c.el
+++ b/test/cedet/semantic-utest-c.el
@@ -1,6 +1,6 @@
1;;; semantic-utest-c.el --- C based parsing tests. 1;;; semantic-utest-c.el --- C based parsing tests.
2 2
3;; Copyright (C) 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <eric@siege-engine.com> 5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/semantic-utest.el b/test/cedet/semantic-utest.el
index 12fbc37a112..728106d863c 100644
--- a/test/cedet/semantic-utest.el
+++ b/test/cedet/semantic-utest.el
@@ -1,6 +1,6 @@
1;;; semantic-utest.el --- Tests for semantic's parsing system. 1;;; semantic-utest.el --- Tests for semantic's parsing system.
2 2
3;;; Copyright (C) 2003-2004, 2007-2011 Free Software Foundation, Inc. 3;;; Copyright (C) 2003-2004, 2007-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <zappo@gnu.org> 5;; Author: Eric M. Ludlam <zappo@gnu.org>
6 6
diff --git a/test/cedet/srecode-tests.el b/test/cedet/srecode-tests.el
index a1b8f60b2ec..d0239f627b3 100644
--- a/test/cedet/srecode-tests.el
+++ b/test/cedet/srecode-tests.el
@@ -1,6 +1,6 @@
1;;; srecode-tests.el --- Some tests for CEDET's srecode 1;;; srecode-tests.el --- Some tests for CEDET's srecode
2 2
3;; Copyright (C) 2008-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <eric@siege-engine.com> 5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/test.c b/test/cedet/tests/test.c
index 6f96f794915..b2d9971ff4f 100644
--- a/test/cedet/tests/test.c
+++ b/test/cedet/tests/test.c
@@ -1,6 +1,6 @@
1/* test.c --- Semantic unit test for C. 1/* test.c --- Semantic unit test for C.
2 2
3 Copyright (C) 2001-2011 Free Software Foundation, Inc. 3 Copyright (C) 2001-2012 Free Software Foundation, Inc.
4 4
5 Author: Eric M. Ludlam <eric@siege-engine.com> 5 Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/test.el b/test/cedet/tests/test.el
index 57056b8065b..a07a9316f35 100644
--- a/test/cedet/tests/test.el
+++ b/test/cedet/tests/test.el
@@ -1,6 +1,6 @@
1;;; test.el --- Unit test file for Semantic Emacs Lisp support. 1;;; test.el --- Unit test file for Semantic Emacs Lisp support.
2 2
3;; Copyright (C) 2005-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2005-2012 Free Software Foundation, Inc.
4 4
5;; Author: Eric M. Ludlam <eric@siege-engine.com> 5;; Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/test.make b/test/cedet/tests/test.make
index a8a3e344cad..cc9d450c1e0 100644
--- a/test/cedet/tests/test.make
+++ b/test/cedet/tests/test.make
@@ -1,6 +1,6 @@
1# test.make --- Semantic unit test for Make -*- makefile -*- 1# test.make --- Semantic unit test for Make -*- makefile -*-
2 2
3# Copyright (C) 2001-2002, 2010-2011 Free Software Foundation, Inc. 3# Copyright (C) 2001-2002, 2010-2012 Free Software Foundation, Inc.
4 4
5# Author: Eric M. Ludlam <eric@siege-engine.com> 5# Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testdoublens.cpp b/test/cedet/tests/testdoublens.cpp
index c0993af0863..72a7e10dc5a 100644
--- a/test/cedet/tests/testdoublens.cpp
+++ b/test/cedet/tests/testdoublens.cpp
@@ -1,6 +1,6 @@
1// testdoublens.cpp --- semantic-ia-utest completion engine unit tests 1// testdoublens.cpp --- semantic-ia-utest completion engine unit tests
2 2
3// Copyright (C) 2008-2011 Free Software Foundation, Inc. 3// Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5// Author: Eric M. Ludlam <eric@siege-engine.com> 5// Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testdoublens.hpp b/test/cedet/tests/testdoublens.hpp
index 94349ed8544..69475ee3c19 100644
--- a/test/cedet/tests/testdoublens.hpp
+++ b/test/cedet/tests/testdoublens.hpp
@@ -1,6 +1,6 @@
1// testdoublens.hpp --- Header file used in one of the Semantic tests 1// testdoublens.hpp --- Header file used in one of the Semantic tests
2 2
3// Copyright (C) 2008-2011 Free Software Foundation, Inc. 3// Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5// Author: Eric M. Ludlam <eric@siege-engine.com> 5// Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testjavacomp.java b/test/cedet/tests/testjavacomp.java
index e9aed8c51f3..54b9f4aa004 100644
--- a/test/cedet/tests/testjavacomp.java
+++ b/test/cedet/tests/testjavacomp.java
@@ -1,6 +1,6 @@
1// testjavacomp.java --- Semantic unit test for Java 1// testjavacomp.java --- Semantic unit test for Java
2 2
3// Copyright (C) 2009-2011 Free Software Foundation, Inc. 3// Copyright (C) 2009-2012 Free Software Foundation, Inc.
4 4
5// Author: Eric M. Ludlam <eric@siege-engine.com> 5// Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testpolymorph.cpp b/test/cedet/tests/testpolymorph.cpp
index 83175406e90..2108da14e56 100644
--- a/test/cedet/tests/testpolymorph.cpp
+++ b/test/cedet/tests/testpolymorph.cpp
@@ -1,6 +1,6 @@
1/** testpolymorph.cpp --- A sequence of polymorphism examples. 1/** testpolymorph.cpp --- A sequence of polymorphism examples.
2 * 2 *
3 * Copyright (C) 2009-2011 Free Software Foundation, Inc. 3 * Copyright (C) 2009-2012 Free Software Foundation, Inc.
4 * 4 *
5 * Author: Eric M. Ludlam <eric@siege-engine.com> 5 * Author: Eric M. Ludlam <eric@siege-engine.com>
6 * 6 *
diff --git a/test/cedet/tests/testspp.c b/test/cedet/tests/testspp.c
index 1cd45e47e1f..1fbabd62d14 100644
--- a/test/cedet/tests/testspp.c
+++ b/test/cedet/tests/testspp.c
@@ -1,6 +1,6 @@
1/* testspp.cpp --- Semantic unit test for the C preprocessor 1/* testspp.cpp --- Semantic unit test for the C preprocessor
2 2
3 Copyright (C) 2007-2011 Free Software Foundation, Inc. 3 Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 4
5 Author: Eric M. Ludlam <eric@siege-engine.com> 5 Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testsppreplace.c b/test/cedet/tests/testsppreplace.c
index 4ec87654dc4..36b4cb5fa57 100644
--- a/test/cedet/tests/testsppreplace.c
+++ b/test/cedet/tests/testsppreplace.c
@@ -1,5 +1,5 @@
1/* testsppreplace.c --- unit test for CPP/SPP Replacement 1/* testsppreplace.c --- unit test for CPP/SPP Replacement
2 Copyright (C) 2007-2011 Free Software Foundation, Inc. 2 Copyright (C) 2007-2012 Free Software Foundation, Inc.
3 3
4 Author: Eric M. Ludlam <eric@siege-engine.com> 4 Author: Eric M. Ludlam <eric@siege-engine.com>
5 5
diff --git a/test/cedet/tests/testsppreplaced.c b/test/cedet/tests/testsppreplaced.c
index 58d1ac2b684..19e3b7ec869 100644
--- a/test/cedet/tests/testsppreplaced.c
+++ b/test/cedet/tests/testsppreplaced.c
@@ -1,5 +1,5 @@
1/* testsppreplaced.c --- unit test for CPP/SPP Replacement 1/* testsppreplaced.c --- unit test for CPP/SPP Replacement
2 Copyright (C) 2007-2011 Free Software Foundation, Inc. 2 Copyright (C) 2007-2012 Free Software Foundation, Inc.
3 3
4 Author: Eric M. Ludlam <eric@siege-engine.com> 4 Author: Eric M. Ludlam <eric@siege-engine.com>
5 5
diff --git a/test/cedet/tests/testsubclass.cpp b/test/cedet/tests/testsubclass.cpp
index 6a704818b0d..3fb61053a41 100644
--- a/test/cedet/tests/testsubclass.cpp
+++ b/test/cedet/tests/testsubclass.cpp
@@ -1,6 +1,6 @@
1// testsubclass.cpp --- unit test for analyzer and complex C++ inheritance 1// testsubclass.cpp --- unit test for analyzer and complex C++ inheritance
2 2
3// Copyright (C) 2007-2011 Free Software Foundation, Inc. 3// Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 4
5// Author: Eric M. Ludlam <eric@siege-engine.com> 5// Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testsubclass.hh b/test/cedet/tests/testsubclass.hh
index 9e6d777d74d..dee470b899f 100644
--- a/test/cedet/tests/testsubclass.hh
+++ b/test/cedet/tests/testsubclass.hh
@@ -1,6 +1,6 @@
1// testsubclass.hh --- unit test for analyzer and complex C++ inheritance 1// testsubclass.hh --- unit test for analyzer and complex C++ inheritance
2 2
3// Copyright (C) 2007-2011 Free Software Foundation, Inc. 3// Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 4
5// Author: Eric M. Ludlam <eric@siege-engine.com> 5// Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testtypedefs.cpp b/test/cedet/tests/testtypedefs.cpp
index f97b1400454..f3666bea316 100644
--- a/test/cedet/tests/testtypedefs.cpp
+++ b/test/cedet/tests/testtypedefs.cpp
@@ -1,6 +1,6 @@
1// testtypedefs.cpp --- Sample with some fake bits out of std::string 1// testtypedefs.cpp --- Sample with some fake bits out of std::string
2 2
3// Copyright (C) 2008-2011 Free Software Foundation, Inc. 3// Copyright (C) 2008-2012 Free Software Foundation, Inc.
4 4
5// Author: Eric M. Ludlam <eric@siege-engine.com> 5// Author: Eric M. Ludlam <eric@siege-engine.com>
6 6
diff --git a/test/cedet/tests/testvarnames.c b/test/cedet/tests/testvarnames.c
index 51d8285730f..5cade2f0bd8 100644
--- a/test/cedet/tests/testvarnames.c
+++ b/test/cedet/tests/testvarnames.c
@@ -1,7 +1,7 @@
1/* testvarnames.cpp 1/* testvarnames.cpp
2 Test variable and function names, lists of variables on one line, etc. 2 Test variable and function names, lists of variables on one line, etc.
3 3
4 Copyright (C) 2008-2011 Free Software Foundation, Inc. 4 Copyright (C) 2008-2012 Free Software Foundation, Inc.
5 5
6 Author: Eric M. Ludlam <eric@siege-engine.com> 6 Author: Eric M. Ludlam <eric@siege-engine.com>
7 7
@@ -31,7 +31,7 @@ struct independent var_indep_struct;
31struct { 31struct {
32 int unnamed_1; 32 int unnamed_1;
33 int unnamed_2; 33 int unnamed_2;
34} var_unamed_struct; 34} var_unnamed_struct;
35 35
36struct { 36struct {
37 int unnamed_3; 37 int unnamed_3;
@@ -59,12 +59,12 @@ struct inline2struct in_var2;
59int test_1(int var_arg1) { 59int test_1(int var_arg1) {
60 60
61 var_// -1- 61 var_// -1-
62 ; // #1# ("var_arg1" "var_indep_struct" "var_n_2" "var_n_3" "var_named_struct" "var_un_2" "var_un_3" "var_unamed_struct") 62 ; // #1# ("var_arg1" "var_indep_struct" "var_n_2" "var_n_3" "var_named_struct" "var_un_2" "var_un_3" "var_unnamed_struct")
63 63
64 var_indep_struct.// -2- 64 var_indep_struct.// -2-
65 ; // #2# ( "indep_1" "indep_2" ) 65 ; // #2# ( "indep_1" "indep_2" )
66 66
67 var_unamed_struct.// -3- 67 var_unnamed_struct.// -3-
68 ; // #3# ( "unnamed_1" "unnamed_2" ) 68 ; // #3# ( "unnamed_1" "unnamed_2" )
69 69
70 var_named_struct.// -4- 70 var_named_struct.// -4-
@@ -88,4 +88,3 @@ int test_1(int var_arg1) {
88 in_var2.// -11- 88 in_var2.// -11-
89 ; // #11# ( "named_3" "named_4") 89 ; // #11# ( "named_3" "named_4")
90} 90}
91
diff --git a/test/eshell.el b/test/eshell.el
index 8a9e62a759a..4d6480c81bb 100644
--- a/test/eshell.el
+++ b/test/eshell.el
@@ -1,6 +1,6 @@
1;;; esh-test.el --- Eshell test suite 1;;; esh-test.el --- Eshell test suite
2 2
3;; Copyright (C) 1999-2011 Free Software Foundation, Inc. 3;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
4 4
5;; Author: John Wiegley <johnw@gnu.org> 5;; Author: John Wiegley <johnw@gnu.org>
6 6
@@ -28,7 +28,7 @@
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile 30(eval-when-compile
31 (require 'cl) ; assert 31 (require 'cl-lib)
32 (require 'eshell) 32 (require 'eshell)
33 (require 'esh-util)) 33 (require 'esh-util))
34(require 'esh-mode) 34(require 'esh-mode)
@@ -267,9 +267,9 @@
267 267
268(eshell-deftest banner banner-displayed 268(eshell-deftest banner banner-displayed
269 "Startup banner is displayed at point-min" 269 "Startup banner is displayed at point-min"
270 (assert eshell-banner-message) 270 (cl-assert eshell-banner-message)
271 (let ((msg (eval eshell-banner-message))) 271 (let ((msg (eval eshell-banner-message)))
272 (assert msg) 272 (cl-assert msg)
273 (goto-char (point-min)) 273 (goto-char (point-min))
274 (looking-at msg))) 274 (looking-at msg)))
275 275
diff --git a/test/indent/latex-mode.tex b/test/indent/latex-mode.tex
new file mode 100644
index 00000000000..55c8e7033bd
--- /dev/null
+++ b/test/indent/latex-mode.tex
@@ -0,0 +1,11 @@
1\documentclass{article} % -*- eval: (bug-reference-mode 1) -*-
2
3\usepackage[utf8]{inputenc}
4
5\begin{document}
6
7To fix this, remove the \url{sn9c102.ko} from where it appears in
8\url{/lib/modules/$(uname -r)}, %bug#11953.
9and install the appropriate \url{gspca-modules} package.
10
11\end{document}
diff --git a/test/indent/perl.perl b/test/indent/perl.perl
new file mode 100755
index 00000000000..2411c96a5e4
--- /dev/null
+++ b/test/indent/perl.perl
@@ -0,0 +1,5 @@
1#!/usr/bin/perl
2# -*- eval: (bug-reference-mode 1) -*-
3
4$fileType_filesButNot # bug#12373?
5 = join( '|', map { quotemeta($_).'$' } @{$fileType->{filesButNot}} );
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
new file mode 100644
index 00000000000..4f2e9e63377
--- /dev/null
+++ b/test/indent/ruby.rb
@@ -0,0 +1,27 @@
1# Percent literals.
2b = %Q{This is a "string"}
3c = %w!foo
4 bar
5 baz!
6d = %(hello (nested) world)
7
8# Don't propertize percent literals inside strings.
9"(%s, %s)" % [123, 456]
10
11# Or inside comments.
12x = # "tot %q/to"; =
13y = 2 / 3
14
15# Regexp after whitelisted method.
16"abc".sub /b/, 'd'
17
18# Don't mis-match "sub" at the end of words.
19a = asub / aslb + bsub / bslb;
20
21# Highlight the regexp after "if".
22x = toto / foo if /do bar/ =~ "dobar"
23
24# Some Cucumber code:
25Given /toto/ do
26 print "hello"
27end
diff --git a/test/indent/shell.rc b/test/indent/shell.rc
index 841223555b9..e5c63e335b9 100755
--- a/test/indent/shell.rc
+++ b/test/indent/shell.rc
@@ -1,7 +1,10 @@
1#!/bin/rc 1#!/bin/rc
2 2
3if (foo) { 3if (foo) {
4 echo 1 4 echo 1 \
5 toto \
6 tutu
7 titi
5} 8}
6if not { 9if not {
7 echo 2 10 echo 2
@@ -23,6 +26,10 @@ switch ($a) {
23 for (i in a b c) 26 for (i in a b c)
24 echo "$i" # KNOWN INDENT BUG 27 echo "$i" # KNOWN INDENT BUG
25 echo titi 28 echo titi
29 if (foo)
30 echo 3 # KNOWN INDENT BUG
31 if not
32 echo 4 # KNOWN INDENT BUG
26 33
27 case * 34 case *
28 echo other 35 echo other
diff --git a/test/indent/shell.sh b/test/indent/shell.sh
index 89f47d0bfe3..6f3447c3aa9 100755
--- a/test/indent/shell.sh
+++ b/test/indent/shell.sh
@@ -1,9 +1,26 @@
1#!/bin/sh 1#!/bin/sh
2# -*- eval: (bug-reference-mode 1) -*-
2 3
3setlock -n /tmp/getmail.lock && echo getmail isn\'t running 4setlock -n /tmp/getmail.lock && echo getmail isn\'t running
4 5
5# adsgsdg 6# adsgsdg
6 7
8echo -n $(( 5 << 2 ))
9# This should not be treated as a heredoc (bug#12770).
102
11
12foo='bar<<' # bug#11263
13echo ${foo%<<aa} # bug#11263
14echo $((1<<8)) # bug#11263
15echo $[1<<8] # bug#11263
16
17declare -a VERSION
18for i in $(ls "$PREFIX/sbin") ; do
19 echo -e $N')' $i
20 VERSION[${#VERSION[*]}]=$i #bug#11946.
21 N=$(($N + 1))
22done
23
7foo () { 24foo () {
8 25
9 bar () { 26 bar () {
@@ -13,11 +30,15 @@ foo () {
13 case toto 30 case toto
14 in a) hello # KNOWN INDENT BUG 31 in a) hello # KNOWN INDENT BUG
15 ;; b) hi # KNOWN INDENT BUG 32 ;; b) hi # KNOWN INDENT BUG
33 ;; c) hi # KNOWN INDENT BUG
16 esac 34 esac
17 35
18 case $toto in 36 case $toto in
19 a) echo 1;; b) echo 2;; 37 a) echo 1;; b) echo 2;;
20 c) echo 3;; 38 (c)
39 echo 3;;
40 d)
41 echo 3;;
21 esac 42 esac
22 43
23 case $as_nl`(ac_space=' '; set) 2>&1` in #( 44 case $as_nl`(ac_space=' '; set) 2>&1` in #(
@@ -34,7 +55,8 @@ foo () {
34 sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" 55 sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
35 ;; 56 ;;
36 esac | 57 esac |
37 cat # KNOWN INDENT BUG 58 grep '.' | # KNOWN INDENT BUG
59 sed 1d
38 60
39 case toto in 61 case toto in
40 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ 62 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
diff --git a/test/redisplay-testsuite.el b/test/redisplay-testsuite.el
index afa42cc494a..39f81a13c60 100644
--- a/test/redisplay-testsuite.el
+++ b/test/redisplay-testsuite.el
@@ -1,6 +1,6 @@
1;;; redisplay-testsuite.el --- Test suite for redisplay. 1;;; redisplay-testsuite.el --- Test suite for redisplay.
2 2
3;; Copyright (C) 2009-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
4 4
5;; Author: Chong Yidong <cyd@stupidchicken.com> 5;; Author: Chong Yidong <cyd@stupidchicken.com>
6;; Keywords: internal 6;; Keywords: internal
@@ -113,7 +113,7 @@
113 (insert "\n\n")) 113 (insert "\n\n"))
114 114
115(defun test-redisplay-3 () 115(defun test-redisplay-3 ()
116 (insert "Test 3: Overlay with before/after strings and images:\n\n") 116 (insert "Test 3: Overlay with strings and images:\n\n")
117 (let ((img-data "#define x_width 8 117 (let ((img-data "#define x_width 8
118#define x_height 8 118#define x_height 8
119static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };")) 119static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff };"))
@@ -165,16 +165,109 @@ static unsigned char x_bits[] = {0xff, 0x81, 0xbd, 0xa5, 0xa5, 0xbd, 0x81, 0xff
165 (overlay-put ov2 'before-string "C") 165 (overlay-put ov2 'before-string "C")
166 (overlay-put ov3 'display `(image :data ,img-data :type xbm)))))) 166 (overlay-put ov3 'display `(image :data ,img-data :type xbm))))))
167 167
168(defun test-redisplay-4 ()
169 (insert "Test 4: Overlay strings and invisibility:\n\n")
170 ;; Before and after strings with non-nil `invisibility'.
171 (insert " Expected: ABC\n")
172 (insert " Result: ")
173 (let ((opoint (point)))
174 (insert "ABC\n")
175 (let ((ov (make-overlay (1+ opoint) (+ 2 opoint))))
176 (overlay-put ov 'before-string
177 (propertize "XX" 'invisible
178 'test-redisplay--simple-invis))
179 (overlay-put ov 'after-string
180 (propertize "XX" 'invisible
181 'test-redisplay--simple-invis))))
182
183 ;; Before and after strings bogus `invisibility' property (value is
184 ;; not listed in `buffer-invisibility-spec').
185 (insert "\n Expected: ABC")
186 (insert "\n Result: ")
187 (let ((opoint (point)))
188 (insert "B\n")
189 (let ((ov (make-overlay opoint (1+ opoint))))
190 (overlay-put ov 'before-string
191 (propertize "A" 'invisible 'bogus-invis-spec))
192 (overlay-put ov 'after-string
193 (propertize "C" 'invisible 'bogus-invis-spec))))
194
195 ;; Before/after string with ellipsis `invisibility' property.
196 (insert "\n Expected: ...B...")
197 (insert "\n Result: ")
198 (let ((opoint (point)))
199 (insert "B\n")
200 (let ((ov (make-overlay opoint (1+ opoint))))
201 (overlay-put ov 'before-string
202 (propertize "A" 'invisible 'test-redisplay--ellipsis-invis))
203 (overlay-put ov 'after-string
204 (propertize "C" 'invisible 'test-redisplay--ellipsis-invis))))
205
206 ;; Before/after string with partial ellipsis `invisibility' property.
207 (insert "\n Expected: A...ABC...C")
208 (insert "\n Result: ")
209 (let ((opoint (point)))
210 (insert "B\n")
211 (let ((ov (make-overlay opoint (1+ opoint)))
212 (a "AAA")
213 (c "CCC"))
214 (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis a)
215 (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis c)
216 (overlay-put ov 'before-string a)
217 (overlay-put ov 'after-string c)))
218
219 ;; Display string with `invisibility' property.
220 (insert "\n Expected: ABC")
221 (insert "\n Result: ")
222 (let ((opoint (point)))
223 (insert "AYBC\n")
224 (let ((ov (make-overlay (1+ opoint) (+ 2 opoint))))
225 (overlay-put ov 'display
226 (propertize "XX" 'invisible
227 'test-redisplay--simple-invis))))
228 ;; Display string with bogus `invisibility' property.
229 (insert "\n Expected: ABC")
230 (insert "\n Result: ")
231 (let ((opoint (point)))
232 (insert "AXC\n")
233 (let ((ov (make-overlay (1+ opoint) (+ 2 opoint))))
234 (overlay-put ov 'display
235 (propertize "B" 'invisible 'bogus-invis-spec))))
236 ;; Display string with ellipsis `invisibility' property.
237 (insert "\n Expected: A...C")
238 (insert "\n Result: ")
239 (let ((opoint (point)))
240 (insert "AXC\n")
241 (let ((ov (make-overlay (1+ opoint) (+ 2 opoint))))
242 (overlay-put ov 'display
243 (propertize "B" 'invisible
244 'test-redisplay--ellipsis-invis))))
245 ;; Display string with partial `invisibility' property.
246 (insert "\n Expected: A...C")
247 (insert "\n Result: ")
248 (let ((opoint (point)))
249 (insert "X\n")
250 (let ((ov (make-overlay opoint (1+ opoint)))
251 (str "ABC"))
252 (put-text-property 1 2 'invisible 'test-redisplay--ellipsis-invis str)
253 (overlay-put ov 'display str)))
254
255 (insert "\n"))
256
168 257
169(defun test-redisplay () 258(defun test-redisplay ()
170 (interactive) 259 (interactive)
171 (let ((buf (get-buffer "*Redisplay Test*"))) 260 (let ((buf (get-buffer "*Redisplay Test*")))
172 (if buf 261 (if buf
173 (kill-buffer buf)) 262 (kill-buffer buf))
174 (pop-to-buffer (get-buffer-create "*Redisplay Test*")) 263 (switch-to-buffer (get-buffer-create "*Redisplay Test*"))
175 (erase-buffer) 264 (erase-buffer)
265 (setq buffer-invisibility-spec
266 '(test-redisplay--simple-invis
267 (test-redisplay--ellipsis-invis . t)))
176 (test-redisplay-1) 268 (test-redisplay-1)
177 (test-redisplay-2) 269 (test-redisplay-2)
178 (test-redisplay-3) 270 (test-redisplay-3)
271 (test-redisplay-4)
179 (goto-char (point-min)))) 272 (goto-char (point-min))))
180 273
diff --git a/test/rmailmm.el b/test/rmailmm.el
index 97577ee35cb..6844eb8187b 100644
--- a/test/rmailmm.el
+++ b/test/rmailmm.el
@@ -1,6 +1,6 @@
1;;; rmailmm.el --- tests for mail/rmailmm.el 1;;; rmailmm.el --- tests for mail/rmailmm.el
2 2
3;; Copyright (C) 2006-2011 Free Software Foundation, Inc. 3;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
4 4
5;; This file is part of GNU Emacs. 5;; This file is part of GNU Emacs.
6 6