Mercurial > hg > xemacs-beta
annotate tests/automated/syntax-tests.el @ 5602:c9e5612f5424
Support the MP library on recent FreeBSD, have it pass relevant tests.
src/ChangeLog addition:
2011-11-26 Aidan Kehoe <kehoea@parhasard.net>
* number-mp.c (bignum_to_string):
Don't overwrite the accumulator we've just set up for this
function.
* number-mp.c (BIGNUM_TO_TYPE):
mp_itom() doesn't necessarily do what this code used to think with
negative numbers, it can treat them as unsigned ints. Subtract
numbers from bignum_zero instead of multiplying them by -1 to
convert them to their negative equivalents.
* number-mp.c (bignum_to_int):
* number-mp.c (bignum_to_uint):
* number-mp.c (bignum_to_long):
* number-mp.c (bignum_to_ulong):
* number-mp.c (bignum_to_double):
Use the changed BIGNUM_TO_TYPE() in these functions.
* number-mp.c (bignum_ceil):
* number-mp.c (bignum_floor):
In these functions, be more careful about rounding to positive and
negative infinity, respectively. Don't use the sign of QUOTIENT
when working out out whether to add or subtract one, rather use
the sign QUOTIENT would have if arbitrary-precision division were
done.
* number-mp.h:
* number-mp.h (MP_GCD):
Wrap #include <mp.h> in BEGIN_C_DECLS/END_C_DECLS.
* number.c (Fbigfloat_get_precision):
* number.c (Fbigfloat_set_precision):
Don't attempt to call XBIGFLOAT_GET_PREC if this build doesn't
support big floats.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 26 Nov 2011 17:59:14 +0000 |
parents | 071b810ceb18 |
children |
rev | line source |
---|---|
398 | 1 ;; Copyright (C) 1999 Free Software Foundation, Inc. |
2 | |
3 ;; Author: Yoshiki Hayashi <t90553@mail.ecc.u-tokyo.ac.jp> | |
4 ;; Maintainer: Yoshiki Hayashi <t90553@mail.ecc.u-tokyo.ac.jp> | |
5 ;; Created: 1999 | |
6 ;; Keywords: tests | |
7 | |
8 ;; This file is part of XEmacs. | |
9 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
10 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
11 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
12 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
13 ;; option) any later version. |
398 | 14 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
18 ;; for more details. |
398 | 19 |
20 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5136
diff
changeset
|
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
398 | 22 |
23 ;;; Synched up with: Not in FSF. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; Test syntax related functions. | |
28 ;; Right now it tests scan_words using forward-word and backward-word. | |
29 ;; See test-harness.el for instructions on how to run these tests. | |
30 | |
31 ;;; Notation | |
32 ;; W: word constituent character. | |
33 ;; NW: non word constituent character. | |
34 ;; -!-: current point. | |
35 ;; EOB: end of buffer | |
36 ;; BOB: beginning of buffer. | |
37 | |
38 ;; Algorithm of scan_words is simple. It just searches SW and then | |
39 ;; moves to NW. When with MULE, it also stops at word boundary. Word | |
40 ;; boundary is tricky and listing all possible cases will be huge. | |
41 ;; Those test are omitted here as it doesn't affect core | |
42 ;; functionality. | |
43 | |
44 (defun test-forward-word (string stop) | |
45 (goto-char (point-max)) | |
46 (let ((point (point))) | |
47 (insert string) | |
48 (goto-char point) | |
49 (forward-word 1) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
50 (Assert (eq (point) (+ point stop))))) |
398 | 51 |
52 (with-temp-buffer | |
53 ;; -!- W NW | |
54 (test-forward-word "W " 1) | |
55 (test-forward-word "WO " 2) | |
56 ;; -!- W EOB | |
57 (test-forward-word "W" 1) | |
58 (test-forward-word "WO" 2) | |
59 ;; -!- NW EOB | |
60 (test-forward-word " " 1) | |
61 (test-forward-word " !" 2) | |
62 ;; -!- NW W NW | |
63 (test-forward-word " W " 2) | |
64 (test-forward-word " WO " 3) | |
65 (test-forward-word " !W " 3) | |
66 (test-forward-word " !WO " 4) | |
67 ;; -!- NW W EOB | |
68 (test-forward-word " W" 2) | |
69 (test-forward-word " WO" 3) | |
70 (test-forward-word " !W" 3) | |
71 (test-forward-word " !WO" 4)) | |
72 | |
73 (defun test-backward-word (string stop) | |
74 (goto-char (point-min)) | |
75 (insert string) | |
76 (let ((point (point))) | |
77 (backward-word 1) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
78 (Assert (eq (point) (- point stop))))) |
398 | 79 |
80 (with-temp-buffer | |
81 ;; NW W -!- | |
82 (test-backward-word " W" 1) | |
83 (test-backward-word " WO" 2) | |
84 ;; BOB W -!- | |
85 (test-backward-word "W" 1) | |
86 (test-backward-word "WO" 2) | |
87 ;; BOB NW -!- | |
88 ;; -!-NW EOB | |
89 (test-backward-word " " 1) | |
90 (test-backward-word " !" 2) | |
91 ;; NW W NW -!- | |
92 (test-backward-word " W " 2) | |
93 (test-backward-word " WO " 3) | |
94 (test-backward-word " W !" 3) | |
95 (test-backward-word " WO !" 4) | |
96 ;; BOB W NW -!- | |
97 (test-backward-word "W " 2) | |
98 (test-backward-word "WO " 3) | |
99 (test-backward-word "W !" 3) | |
100 (test-backward-word "WO !" 4)) | |
460 | 101 |
102 ;; Works like test-forward-word, except for the following: | |
103 ;; after <string> is inserted, the syntax-table <apply-syntax> | |
104 ;; is applied to position <apply-pos>. | |
105 ;; <apply-pos> can be in the form (start . end), or can be a | |
106 ;; character position. | |
107 (defun test-syntax-table (string apply-pos apply-syntax stop) | |
1024 | 108 ;; We don't necessarily have syntax-table properties ... |
109 (when (fboundp 'lookup-syntax-properties) ; backwards compatible kludge | |
110 ;; ... and they may not be enabled by default if we do. | |
111 (setq lookup-syntax-properties t) | |
112 (goto-char (point-max)) | |
113 (unless (consp apply-pos) | |
114 (setq apply-pos `(,apply-pos . ,(+ 1 apply-pos)))) | |
115 (let ((point (point))) | |
116 (insert string) | |
117 (put-text-property (+ point (car apply-pos)) (+ point (cdr apply-pos)) | |
118 'syntax-table apply-syntax) | |
119 (goto-char point) | |
120 (forward-word 1) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
121 (Assert (eq (point) (+ point stop)))))) |
460 | 122 |
123 ;; test syntax-table extents | |
124 (with-temp-buffer | |
125 ;; Apply punctuation to word | |
126 (test-syntax-table "WO" 1 `(,(syntax-string-to-code ".")) 1) | |
127 ;; Apply word to punctuation | |
128 (test-syntax-table "W." 1 `(,(syntax-string-to-code "w")) 2)) | |
129 | |
3880 | 130 ;; According to Ralf Angeli in |
131 ;; http://article.gmane.org/gmane.emacs.xemacs.beta/17353: | |
132 ;; Using a fresh CVS checkout of XEmacs trunk the following snippet | |
133 ;; returns "1" when evaluated whereas it returns "5" in GNU Emacs 21.3, | |
134 ;; CVS GNU Emacs and XEmacs 21.4.15. | |
135 ;; If `set-syntax-table' is used instead of `with-syntax-table', CVS | |
136 ;; XEmacs returns "5" as well, so I suppose that there is a problem in | |
137 ;; `with-syntax-table' or a function called by it. | |
138 | |
139 ;; Fixed 2007-03-25 Olivier Galibert <20070324221053.GA48218@dspnet.fr.eu.org> | |
140 (with-temp-buffer | |
141 (with-syntax-table (make-syntax-table) | |
142 (insert "foo bar") | |
143 (backward-sexp 1) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
144 (Assert (eql (point) 5)))) |
3880 | 145 |
460 | 146 ;; Test forward-comment at buffer boundaries |
1024 | 147 ;; #### The second Assert fails (once interpreted, once compiled) on 21.4.9 |
148 ;; with sjt's version of Andy's syntax-text-property-killer patch. | |
460 | 149 (with-temp-buffer |
1095 | 150 (Skip-Test-Unless (fboundp 'c-mode) |
151 "c-mode unavailable" | |
152 "comment and parse-partial-sexp tests" | |
973 | 153 (c-mode) |
154 | |
155 (insert "// comment\n") | |
156 (forward-comment -2) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
157 (Assert (eq (point) (point-min))) |
460 | 158 |
973 | 159 (let ((point (point))) |
160 (insert "/* comment */") | |
161 (goto-char point) | |
162 (forward-comment 2) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
163 (Assert (eq (point) (point-max))) |
460 | 164 |
973 | 165 ;; this last used to crash |
166 (parse-partial-sexp point (point-max))))) | |
3130 | 167 |
168 ;; Test backward-up-list | |
169 ;; Known-Bug: report = Evgeny Zacjev ca 2005-12-01, confirm = Aidan Kehoe | |
170 | |
171 (with-temp-buffer | |
172 ;; We are now using the standard syntax table. Thus there's no need to | |
173 ;; worry about a bogus syntax setting, eg, in a Gnus Article buffer the | |
174 ;; bug doesn't manifest. | |
175 | |
176 ;; value of point to the immediate left of this character | |
177 ;; 0 1 2 | |
178 ;; 1234 56789 012 34567 890 12 3456 7 | |
179 (insert "a ( \"b (c\" (\"defg\") \")\") h\n") | |
180 | |
181 ;; #### This test should check *every* position. | |
5576
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5545
diff
changeset
|
182 (labels ((backward-up-list-moves-point-from-to (start expected-end) |
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5545
diff
changeset
|
183 (goto-char start) |
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5545
diff
changeset
|
184 (backward-up-list 1) |
071b810ceb18
Declare labels as line where appropriate; use #'labels, not #'flet, tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5545
diff
changeset
|
185 (= (point) expected-end))) |
3130 | 186 (Known-Bug-Expect-Failure |
187 ;; Evgeny's case | |
188 (Assert (backward-up-list-moves-point-from-to 16 12))) | |
189 (Assert (backward-up-list-moves-point-from-to 19 12)) | |
190 (Assert (backward-up-list-moves-point-from-to 20 3)) | |
191 (Known-Bug-Expect-Failure | |
192 (Assert (backward-up-list-moves-point-from-to 22 3))) | |
5065
133e816778ed
fix expected-buggy test to avoid abort in test file
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
193 (Known-Bug-Expect-Error scan-error |
133e816778ed
fix expected-buggy test to avoid abort in test file
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
194 (Assert (backward-up-list-moves-point-from-to 23 3)) |
133e816778ed
fix expected-buggy test to avoid abort in test file
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
195 ) |
3130 | 196 (Assert (backward-up-list-moves-point-from-to 24 3)) |
197 ;; This is maybe a little tricky, since we don't expect the position | |
198 ;; check to happen -- so use an illegal expected position | |
199 ;; I don't think there's any other way for this to fail that way, | |
200 ;; barring hardware error.... | |
201 (Check-Error-Message syntax-error | |
202 "Unbalanced parentheses" | |
203 (backward-up-list-moves-point-from-to 25 nil)) | |
204 ;; special-case check that point didn't move | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5065
diff
changeset
|
205 (Assert (= (point) 25)))) |
3130 | 206 |
5545
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
207 ;; Test inspired by Alan Mackenzie in <20110806200042.GA3406@acm.acm> |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
208 ;; on xemacs-beta 2011-08-06. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
209 ;; Known to fail in r5531 (#1b054bc2ac40) plus some additional patches to |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
210 ;; syntax code, and passes with Alan's suggested patch ca. r5545. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
211 ;; #### The results of these tests are empirically determined, and will |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
212 ;; probably change as the syntax cache is documented and repaired. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
213 (with-temp-buffer |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
214 ;; buffer->syntax_cache in just-initialized state. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
215 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
216 (Assert (= 1 (nth 0 sci)) nil "just initialized") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
217 (Assert (= 1 (nth 1 sci)) nil "just initialized") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
218 (Assert (= -1 (nth 2 sci)) nil "just initialized") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
219 (Assert (= -1 (nth 3 sci)) nil "just initialized")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
220 ;; Alan's example uses ?/ not ?, but ?/ has Ssymbol syntax, which would |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
221 ;; mean it is treated the same as the letters by forward-sexp. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
222 (insert ",regexp, {") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
223 ;; Insertion updates markers, but not the cache boundaries. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
224 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
225 (Assert (= 1 (nth 0 sci)) nil "after main insert") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
226 (Assert (= 11 (nth 1 sci)) nil "after main insert") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
227 (Assert (= -1 (nth 2 sci)) nil "after main insert") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
228 (Assert (= -1 (nth 3 sci)) nil "after main insert")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
229 ;; #### Interactively inserting in fundamental mode swaps marker positions! |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
230 ;; Why? |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
231 (insert "}") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
232 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
233 (Assert (= 1 (nth 0 sci)) nil "after brace insert") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
234 (Assert (= 12 (nth 1 sci)) nil "after brace insert") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
235 (Assert (= -1 (nth 2 sci)) nil "after brace insert") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
236 (Assert (= -1 (nth 3 sci)) nil "after brace insert")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
237 ;; Motion that ignores the cache should not update the cache. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
238 (goto-char (point-min)) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
239 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
240 (Assert (= 1 (nth 0 sci)) nil "after movement 0") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
241 (Assert (= 12 (nth 1 sci)) nil "after movement 0") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
242 (Assert (= -1 (nth 2 sci)) nil "after movement 0") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
243 (Assert (= -1 (nth 3 sci)) nil "after movement 0")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
244 ;; Cache should be updated and global since no syntax-table property. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
245 (forward-sexp 1) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
246 (Assert (= (point) 8) nil "after 1st forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
247 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
248 (Assert (= 1 (nth 0 sci)) nil "after 1st forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
249 (Assert (= 12 (nth 1 sci)) nil "after 1st forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
250 (Assert (= 1 (nth 2 sci)) nil "after 1st forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
251 (Assert (= 12 (nth 3 sci)) nil "after 1st forward-sexp")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
252 ;; Adding the text property should invalidate the cache. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
253 (put-text-property 1 2 'syntax-table '(7)) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
254 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
255 (Assert (= 1 (nth 0 sci)) nil "after putting property") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
256 (Assert (= 1 (nth 1 sci)) nil "after putting property") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
257 (Assert (= -1 (nth 2 sci)) nil "after putting property") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
258 (Assert (= -1 (nth 3 sci)) nil "after putting property")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
259 (put-text-property 8 9 'syntax-table '(7)) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
260 (goto-char (point-min)) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
261 ;; Motion that is stopped by a syntax-table property should impose |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
262 ;; that property's region on the cache. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
263 (forward-sexp 1) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
264 (Assert (= (point) 9) nil "after 2d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
265 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
266 (Assert (= 8 (nth 0 sci)) nil "after 2d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
267 (Assert (= 9 (nth 1 sci)) nil "after 2d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
268 (Assert (= 8 (nth 2 sci)) nil "after 2d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
269 (Assert (= 9 (nth 3 sci)) nil "after 2d forward-sexp")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
270 ;; Narrowing warps point but does not affect the cache. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
271 (narrow-to-region 10 12) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
272 (Assert (= 10 (point)) nil "after narrowing") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
273 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
274 (Assert (= 8 (nth 0 sci)) nil "after narrowing") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
275 (Assert (= 9 (nth 1 sci)) nil "after narrowing") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
276 (Assert (= 8 (nth 2 sci)) nil "after narrowing") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
277 (Assert (= 9 (nth 3 sci)) nil "after narrowing")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
278 ;; Motion that is stopped by buffer's syntax table should capture |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
279 ;; the largest region known to not contain a change of syntax-table |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
280 ;; property. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
281 (forward-sexp 1) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
282 (let ((sci (syntax-cache-info))) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
283 (Assert (= 10 (nth 0 sci)) nil "after 3d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
284 (Assert (= 12 (nth 1 sci)) nil "after 3d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
285 (Assert (= 10 (nth 2 sci)) nil "after 3d forward-sexp") |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
286 (Assert (= 12 (nth 3 sci)) nil "after 3d forward-sexp")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
287 (widen) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
288 (goto-char (point-min)) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
289 ;; Check that we still respect the syntax table properties. |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
290 (forward-sexp 1) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
291 (Assert (= 9 (point)) nil "after widening")) |
69de75c48efa
Alan Mackenzie's syntax cache bounds fix.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5543
diff
changeset
|
292 |
5543
fbe90e6f7a43
Initialize start and end properly (to new markers, not Qnil).
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5540
diff
changeset
|
293 ;; #### Add the recipe in <yxzfymklb6p.fsf@gimli.holgi.priv> on xemacs-beta. |
fbe90e6f7a43
Initialize start and end properly (to new markers, not Qnil).
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5540
diff
changeset
|
294 ;; You also need to do a DELETE or type SPC to get the crash in 21.5.24. |
fbe90e6f7a43
Initialize start and end properly (to new markers, not Qnil).
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5540
diff
changeset
|
295 ;http://list-archive.xemacs.org/pipermail/xemacs-beta/2006-February/008430.html |
fbe90e6f7a43
Initialize start and end properly (to new markers, not Qnil).
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5540
diff
changeset
|
296 |
5540
eed303fac325
Should tests for substitute-in-file-name be in syntax-tests?
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5402
diff
changeset
|
297 ;;; end of syntax-tests.el |