aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ChangeLog4
-rw-r--r--test/cedet/tests/testjavacomp.java28
-rw-r--r--test/cedet/tests/testpolymorph.cpp24
-rw-r--r--test/occur-testsuite.el140
4 files changed, 170 insertions, 26 deletions
diff --git a/test/ChangeLog b/test/ChangeLog
index b45e2f1576a..ee69172241d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,7 @@
12010-03-23 Juri Linkov <juri@jurta.org>
2
3 * occur-testsuite.el: New file.
4
12010-03-10 Chong Yidong <cyd@stupidchicken.com> 52010-03-10 Chong Yidong <cyd@stupidchicken.com>
2 6
3 * Branch for 23.2. 7 * Branch for 23.2.
diff --git a/test/cedet/tests/testjavacomp.java b/test/cedet/tests/testjavacomp.java
index feffe660e04..3c2c2ef4ebe 100644
--- a/test/cedet/tests/testjavacomp.java
+++ b/test/cedet/tests/testjavacomp.java
@@ -1,23 +1,23 @@
1/** testjavacomp.java --- 1/** testjavacomp.java ---
2 * 2 *
3 * Copyright (C) 2009 Eric M. Ludlam 3 * Copyright (C) 2009, 2010 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 *
7 * This program is free software; you can redistribute it and/or 7 * This file is part of GNU Emacs.
8 * modify it under the terms of the GNU General Public License as 8 *
9 * published by the Free Software Foundation; either version 2, or (at 9 * GNU Emacs is free software: you can redistribute it and/or modify
10 * your option) any later version. 10 * it under the terms of the GNU General Public License as published by
11 * 11 * the Free Software Foundation, either version 3 of the License, or
12 * This program is distributed in the hope that it will be useful, but 12 * (at your option) any later version.
13 * WITHOUT ANY WARRANTY; without even the implied warranty of 13 *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * GNU Emacs is distributed in the hope that it will be useful,
15 * General Public License for more details. 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
17 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to 20 * along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23package tests.testjavacomp; 23package tests.testjavacomp;
diff --git a/test/cedet/tests/testpolymorph.cpp b/test/cedet/tests/testpolymorph.cpp
index 51f933cf7fd..329f4d598f4 100644
--- a/test/cedet/tests/testpolymorph.cpp
+++ b/test/cedet/tests/testpolymorph.cpp
@@ -1,23 +1,23 @@
1/** testpolymorph.cpp --- A sequence of polymorphism examples. 1/** testpolymorph.cpp --- A sequence of polymorphism examples.
2 * 2 *
3 * Copyright (C) 2009 Eric M. Ludlam 3 * Copyright (C) 2009, 2010 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 *
7 * This program is free software; you can redistribute it and/or 7 * This file is part of GNU Emacs.
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2, or (at
10 * your option) any later version.
11 * 8 *
12 * This program is distributed in the hope that it will be useful, but 9 * GNU Emacs is free software: you can redistribute it and/or modify
13 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * it under the terms of the GNU General Public License as published by
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * the Free Software Foundation, either version 3 of the License, or
15 * General Public License for more details. 12 * (at your option) any later version.
13 *
14 * GNU Emacs is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
16 * 18 *
17 * You should have received a copy of the GNU General Public License 19 * You should have received a copy of the GNU General Public License
18 * along with this program; see the file COPYING. If not, write to 20 * along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23#include <cmath> 23#include <cmath>
diff --git a/test/occur-testsuite.el b/test/occur-testsuite.el
new file mode 100644
index 00000000000..d817805dd67
--- /dev/null
+++ b/test/occur-testsuite.el
@@ -0,0 +1,140 @@
1;;; occur-testsuite.el --- Test suite for occur.
2
3;; Copyright (C) 2010 Free Software Foundation, Inc.
4
5;; Author: Juri Linkov <juri@jurta.org>
6;; Keywords: matching, internal
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;;; Commentary:
24
25;; Type M-x test-occur RET to test the functionality of `occur'.
26
27;;; Code:
28
29(defconst occur-tests
30 '(
31 ;; * Test one-line matches (at bob, eob, bol, eol).
32 ("x" 0 "\
33xa
34b
35cx
36xd
37xex
38fx
39" "\
405 matches for \"x\" in buffer: *temp*
41 1:xa
42 3:cx
43 4:xd
44 5:xex
45 6:fx
46")
47 ;; * Test multi-line matches, this is the first test from
48 ;; http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01008.html
49 ;; where numbers are replaced with letters.
50 ("a\na" 0 "\
51a
52a
53a
54a
55a
56" "\
572 matches for \"a^Ja\" in buffer: *temp*
58 1:a
59 :a
60 3:a
61 :a
62")
63 ;; * Test multi-line matches, this is the second test from
64 ;; http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01008.html
65 ;; where numbers are replaced with letters.
66 ("a\nb" 0 "\
67a
68b
69c
70a
71b
72" "\
732 matches for \"a^Jb\" in buffer: *temp*
74 1:a
75 :b
76 4:a
77 :b
78")
79 ;; * Test line numbers for multi-line matches with empty last match line.
80 ("a\n" 0 "\
81a
82
83c
84a
85
86" "\
872 matches for \"a^J\" in buffer: *temp*
88 1:a
89 :
90 4:a
91 :
92")
93 ;; * Test multi-line matches with 3 match lines.
94 ("x\n.x\n" 0 "\
95ax
96bx
97c
98d
99ex
100fx
101" "\
1022 matches for \"x^J.x^J\" in buffer: *temp*
103 1:ax
104 :bx
105 :c
106 5:ex
107 :fx
108 :
109")
110 )
111 "List of tests for `occur'.
112Each element has the format:
113\(REGEXP NLINES INPUT-BUFFER-STRING OUTPUT-BUFFER-STRING).")
114
115(defun test-occur ()
116 (interactive)
117 (let ((count 1)
118 failed
119 (occur-hook nil))
120 (dolist (test occur-tests)
121 (let ((regexp (nth 0 test))
122 (nlines (nth 1 test))
123 (input-buffer-string (nth 2 test))
124 (output-buffer-string (nth 3 test)))
125 (save-excursion
126 (with-temp-buffer
127 (insert input-buffer-string)
128 (occur regexp nlines)
129 (unless (equal output-buffer-string
130 (with-current-buffer "*Occur*"
131 (buffer-string)))
132 (setq failed (cons count failed))))))
133 (setq count (1+ count)))
134 (if failed
135 (message "FAILED TESTS: %S" (reverse failed))
136 (message "SUCCESS"))))
137
138(provide 'occur-testsuite)
139
140;;; occur-testsuite.el ends here