Mercurial > emacs
annotate test/occur-testsuite.el @ 108263:9ca2a7762d32
src/Makefile.in: Convert comment in cpp section to the right format.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 05 May 2010 22:50:26 -0700 |
parents | bfde3c2dbef5 |
children | 6378d1b57038 |
rev | line source |
---|---|
107477 | 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 "\ | |
33 xa | |
34 b | |
35 cx | |
36 xd | |
37 xex | |
38 fx | |
39 " "\ | |
40 5 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 "\ | |
51 a | |
52 a | |
53 a | |
54 a | |
55 a | |
56 " "\ | |
57 2 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 "\ | |
67 a | |
68 b | |
69 c | |
70 a | |
71 b | |
72 " "\ | |
73 2 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 "\ | |
81 a | |
82 | |
83 c | |
84 a | |
85 | |
86 " "\ | |
87 2 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 "\ | |
95 ax | |
96 bx | |
97 c | |
98 d | |
99 ex | |
100 fx | |
101 " "\ | |
102 2 matches for \"x^J.x^J\" in buffer: *temp* | |
103 1:ax | |
104 :bx | |
105 :c | |
106 5:ex | |
107 :fx | |
108 : | |
109 ") | |
107653
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
110 ;; * Test non-overlapping context lines with matches at bob/eob. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
111 ("x" 1 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
112 ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
113 b |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
114 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
115 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
116 ex |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
117 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
118 g |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
119 hx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
120 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
121 3 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
122 1:ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
123 :b |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
124 ------- |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
125 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
126 5:ex |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
127 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
128 ------- |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
129 :g |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
130 8:hx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
131 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
132 ;; * Test non-overlapping context lines with matches not at bob/eob. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
133 ("x" 1 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
134 a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
135 bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
136 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
137 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
138 ex |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
139 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
140 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
141 2 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
142 :a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
143 2:bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
144 :c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
145 ------- |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
146 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
147 5:ex |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
148 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
149 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
150 ;; * Test overlapping context lines with matches at bob/eob. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
151 ("x" 2 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
152 ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
153 bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
154 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
155 dx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
156 e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
157 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
158 gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
159 h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
160 i |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
161 j |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
162 kx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
163 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
164 5 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
165 1:ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
166 2:bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
167 :c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
168 4:dx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
169 :e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
170 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
171 7:gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
172 :h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
173 :i |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
174 :j |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
175 11:kx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
176 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
177 ;; * Test overlapping context lines with matches not at bob/eob. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
178 ("x" 2 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
179 a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
180 b |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
181 cx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
182 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
183 e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
184 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
185 gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
186 h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
187 i |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
188 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
189 2 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
190 :a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
191 :b |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
192 3:cx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
193 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
194 :e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
195 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
196 7:gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
197 :h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
198 :i |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
199 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
200 ;; * Test overlapping context lines with empty first and last line.. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
201 ("x" 2 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
202 |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
203 b |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
204 cx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
205 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
206 e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
207 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
208 gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
209 h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
210 |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
211 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
212 2 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
213 : |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
214 :b |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
215 3:cx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
216 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
217 :e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
218 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
219 7:gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
220 :h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
221 : |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
222 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
223 ;; * Test multi-line overlapping context lines. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
224 ("x\n.x" 2 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
225 ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
226 bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
227 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
228 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
229 ex |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
230 fx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
231 g |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
232 h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
233 i |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
234 jx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
235 kx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
236 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
237 3 matches for \"x^J.x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
238 1:ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
239 :bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
240 :c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
241 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
242 5:ex |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
243 :fx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
244 :g |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
245 :h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
246 :i |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
247 10:jx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
248 :kx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
249 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
250 ;; * Test multi-line non-overlapping context lines. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
251 ("x\n.x" 2 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
252 ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
253 bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
254 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
255 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
256 e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
257 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
258 gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
259 hx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
260 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
261 2 matches for \"x^J.x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
262 1:ax |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
263 :bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
264 :c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
265 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
266 ------- |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
267 :e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
268 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
269 7:gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
270 :hx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
271 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
272 ;; * Test non-overlapping negative (before-context) lines. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
273 ("x" -2 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
274 a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
275 bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
276 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
277 d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
278 e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
279 fx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
280 g |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
281 h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
282 ix |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
283 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
284 3 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
285 :a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
286 2:bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
287 ------- |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
288 :d |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
289 :e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
290 6:fx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
291 ------- |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
292 :g |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
293 :h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
294 9:ix |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
295 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
296 ;; * Test overlapping negative (before-context) lines. |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
297 ("x" -3 "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
298 a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
299 bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
300 c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
301 dx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
302 e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
303 f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
304 gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
305 h |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
306 " "\ |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
307 3 matches for \"x\" in buffer: *temp* |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
308 :a |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
309 2:bx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
310 :c |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
311 4:dx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
312 :e |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
313 :f |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
314 7:gx |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
315 ") |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
316 |
bfde3c2dbef5
Make occur handle multi-line matches cleanly with context.
Juri Linkov <juri@jurta.org>
parents:
107477
diff
changeset
|
317 ) |
107477 | 318 "List of tests for `occur'. |
319 Each element has the format: | |
320 \(REGEXP NLINES INPUT-BUFFER-STRING OUTPUT-BUFFER-STRING).") | |
321 | |
322 (defun test-occur () | |
323 (interactive) | |
324 (let ((count 1) | |
325 failed | |
326 (occur-hook nil)) | |
327 (dolist (test occur-tests) | |
328 (let ((regexp (nth 0 test)) | |
329 (nlines (nth 1 test)) | |
330 (input-buffer-string (nth 2 test)) | |
331 (output-buffer-string (nth 3 test))) | |
332 (save-excursion | |
333 (with-temp-buffer | |
334 (insert input-buffer-string) | |
335 (occur regexp nlines) | |
336 (unless (equal output-buffer-string | |
337 (with-current-buffer "*Occur*" | |
338 (buffer-string))) | |
339 (setq failed (cons count failed)))))) | |
340 (setq count (1+ count))) | |
341 (if failed | |
342 (message "FAILED TESTS: %S" (reverse failed)) | |
343 (message "SUCCESS")))) | |
344 | |
345 (provide 'occur-testsuite) | |
346 | |
347 ;;; occur-testsuite.el ends here |