annotate test/occur-testsuite.el @ 112433:7b649f6eac4f

Merge from mainline.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 22 Jan 2011 17:09:09 -0800
parents 6378d1b57038
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107477
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
1 ;;; occur-testsuite.el --- Test suite for occur.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
2
112275
6378d1b57038 Add 2011 to remaining FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents: 107653
diff changeset
3 ;; Copyright (C) 2010, 2011 Free Software Foundation, Inc.
107477
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
4
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
5 ;; Author: Juri Linkov <juri@jurta.org>
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
6 ;; Keywords: matching, internal
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
7
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
9
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
13 ;; (at your option) any later version.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
14
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
19
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
22
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
23 ;;; Commentary:
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
24
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
25 ;; Type M-x test-occur RET to test the functionality of `occur'.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
26
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
27 ;;; Code:
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
28
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
29 (defconst occur-tests
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
30 '(
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
31 ;; * Test one-line matches (at bob, eob, bol, eol).
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
32 ("x" 0 "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
33 xa
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
34 b
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
35 cx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
36 xd
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
37 xex
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
38 fx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
39 " "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
40 5 matches for \"x\" in buffer: *temp*
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
41 1:xa
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
42 3:cx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
43 4:xd
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
44 5:xex
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
45 6:fx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
46 ")
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
47 ;; * Test multi-line matches, this is the first test from
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
48 ;; http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01008.html
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
49 ;; where numbers are replaced with letters.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
50 ("a\na" 0 "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
51 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
52 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
53 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
54 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
55 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
56 " "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
57 2 matches for \"a^Ja\" in buffer: *temp*
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
58 1:a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
59 :a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
60 3:a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
61 :a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
62 ")
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
63 ;; * Test multi-line matches, this is the second test from
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
64 ;; http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01008.html
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
65 ;; where numbers are replaced with letters.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
66 ("a\nb" 0 "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
67 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
68 b
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
69 c
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
70 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
71 b
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
72 " "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
73 2 matches for \"a^Jb\" in buffer: *temp*
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
74 1:a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
75 :b
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
76 4:a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
77 :b
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
78 ")
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
79 ;; * Test line numbers for multi-line matches with empty last match line.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
80 ("a\n" 0 "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
81 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
82
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
83 c
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
84 a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
85
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
86 " "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
87 2 matches for \"a^J\" in buffer: *temp*
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
88 1:a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
89 :
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
90 4:a
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
91 :
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
92 ")
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
93 ;; * Test multi-line matches with 3 match lines.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
94 ("x\n.x\n" 0 "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
95 ax
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
96 bx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
97 c
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
98 d
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
99 ex
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
100 fx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
101 " "\
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
102 2 matches for \"x^J.x^J\" in buffer: *temp*
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
103 1:ax
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
104 :bx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
105 :c
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
106 5:ex
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
107 :fx
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
108 :
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
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
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
318 "List of tests for `occur'.
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
319 Each element has the format:
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
320 \(REGEXP NLINES INPUT-BUFFER-STRING OUTPUT-BUFFER-STRING).")
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
321
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
322 (defun test-occur ()
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
323 (interactive)
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
324 (let ((count 1)
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
325 failed
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
326 (occur-hook nil))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
327 (dolist (test occur-tests)
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
328 (let ((regexp (nth 0 test))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
329 (nlines (nth 1 test))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
330 (input-buffer-string (nth 2 test))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
331 (output-buffer-string (nth 3 test)))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
332 (save-excursion
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
333 (with-temp-buffer
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
334 (insert input-buffer-string)
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
335 (occur regexp nlines)
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
336 (unless (equal output-buffer-string
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
337 (with-current-buffer "*Occur*"
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
338 (buffer-string)))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
339 (setq failed (cons count failed))))))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
340 (setq count (1+ count)))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
341 (if failed
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
342 (message "FAILED TESTS: %S" (reverse failed))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
343 (message "SUCCESS"))))
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
344
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
345 (provide 'occur-testsuite)
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
346
1039cde2a81b * occur-testsuite.el: New file.
Juri Linkov <juri@jurta.org>
parents:
diff changeset
347 ;;; occur-testsuite.el ends here