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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
1 ;; Copyright (C) 1999 Free Software Foundation, Inc.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
2
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
3 ;; Author: Yoshiki Hayashi <t90553@mail.ecc.u-tokyo.ac.jp>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
4 ;; Maintainer: Yoshiki Hayashi <t90553@mail.ecc.u-tokyo.ac.jp>
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
5 ;; Created: 1999
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
6 ;; Keywords: tests
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
7
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
19
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
22
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
23 ;;; Synched up with: Not in FSF.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
24
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
25 ;;; Commentary:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
26
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
27 ;; Test syntax related functions.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
28 ;; Right now it tests scan_words using forward-word and backward-word.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
29 ;; See test-harness.el for instructions on how to run these tests.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
30
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
31 ;;; Notation
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
32 ;; W: word constituent character.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
33 ;; NW: non word constituent character.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
34 ;; -!-: current point.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
35 ;; EOB: end of buffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
36 ;; BOB: beginning of buffer.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
37
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
38 ;; Algorithm of scan_words is simple. It just searches SW and then
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
39 ;; moves to NW. When with MULE, it also stops at word boundary. Word
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
40 ;; boundary is tricky and listing all possible cases will be huge.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
41 ;; Those test are omitted here as it doesn't affect core
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
42 ;; functionality.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
43
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
44 (defun test-forward-word (string stop)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
45 (goto-char (point-max))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
46 (let ((point (point)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
47 (insert string)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
48 (goto-char point)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
51
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
52 (with-temp-buffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
53 ;; -!- W NW
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
54 (test-forward-word "W " 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
55 (test-forward-word "WO " 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
56 ;; -!- W EOB
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
57 (test-forward-word "W" 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
58 (test-forward-word "WO" 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
59 ;; -!- NW EOB
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
60 (test-forward-word " " 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
61 (test-forward-word " !" 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
62 ;; -!- NW W NW
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
63 (test-forward-word " W " 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
64 (test-forward-word " WO " 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
65 (test-forward-word " !W " 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
66 (test-forward-word " !WO " 4)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
67 ;; -!- NW W EOB
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
68 (test-forward-word " W" 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
69 (test-forward-word " WO" 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
70 (test-forward-word " !W" 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
71 (test-forward-word " !WO" 4))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
72
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
73 (defun test-backward-word (string stop)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
74 (goto-char (point-min))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
75 (insert string)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
76 (let ((point (point)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
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
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
79
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
80 (with-temp-buffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
81 ;; NW W -!-
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
82 (test-backward-word " W" 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
83 (test-backward-word " WO" 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
84 ;; BOB W -!-
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
85 (test-backward-word "W" 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
86 (test-backward-word "WO" 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
87 ;; BOB NW -!-
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
88 ;; -!-NW EOB
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
89 (test-backward-word " " 1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
90 (test-backward-word " !" 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
91 ;; NW W NW -!-
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
92 (test-backward-word " W " 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
93 (test-backward-word " WO " 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
94 (test-backward-word " W !" 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
95 (test-backward-word " WO !" 4)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
96 ;; BOB W NW -!-
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
97 (test-backward-word "W " 2)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
98 (test-backward-word "WO " 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
99 (test-backward-word "W !" 3)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents:
diff changeset
100 (test-backward-word "WO !" 4))
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
101
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
102 ;; Works like test-forward-word, except for the following:
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
103 ;; after <string> is inserted, the syntax-table <apply-syntax>
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
104 ;; is applied to position <apply-pos>.
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
105 ;; <apply-pos> can be in the form (start . end), or can be a
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
106 ;; character position.
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
107 (defun test-syntax-table (string apply-pos apply-syntax stop)
1024
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
108 ;; We don't necessarily have syntax-table properties ...
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
109 (when (fboundp 'lookup-syntax-properties) ; backwards compatible kludge
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
110 ;; ... and they may not be enabled by default if we do.
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
111 (setq lookup-syntax-properties t)
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
112 (goto-char (point-max))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
113 (unless (consp apply-pos)
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
114 (setq apply-pos `(,apply-pos . ,(+ 1 apply-pos))))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
115 (let ((point (point)))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
116 (insert string)
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
117 (put-text-property (+ point (car apply-pos)) (+ point (cdr apply-pos))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
118 'syntax-table apply-syntax)
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
119 (goto-char point)
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
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
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
122
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
123 ;; test syntax-table extents
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
124 (with-temp-buffer
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
125 ;; Apply punctuation to word
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
126 (test-syntax-table "WO" 1 `(,(syntax-string-to-code ".")) 1)
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
127 ;; Apply word to punctuation
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
128 (test-syntax-table "W." 1 `(,(syntax-string-to-code "w")) 2))
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
129
3880
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
130 ;; According to Ralf Angeli in
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
131 ;; http://article.gmane.org/gmane.emacs.xemacs.beta/17353:
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
132 ;; Using a fresh CVS checkout of XEmacs trunk the following snippet
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
133 ;; returns "1" when evaluated whereas it returns "5" in GNU Emacs 21.3,
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
134 ;; CVS GNU Emacs and XEmacs 21.4.15.
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
135 ;; If `set-syntax-table' is used instead of `with-syntax-table', CVS
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
136 ;; XEmacs returns "5" as well, so I suppose that there is a problem in
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
137 ;; `with-syntax-table' or a function called by it.
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
138
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
139 ;; Fixed 2007-03-25 Olivier Galibert <20070324221053.GA48218@dspnet.fr.eu.org>
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
140 (with-temp-buffer
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
141 (with-syntax-table (make-syntax-table)
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
142 (insert "foo bar")
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
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
4035bd42c75e [xemacs-hg @ 2007-03-25 15:57:32 by stephent]
stephent
parents: 3130
diff changeset
145
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
146 ;; Test forward-comment at buffer boundaries
1024
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
147 ;; #### The second Assert fails (once interpreted, once compiled) on 21.4.9
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 973
diff changeset
148 ;; with sjt's version of Andy's syntax-text-property-killer patch.
460
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
149 (with-temp-buffer
1095
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
150 (Skip-Test-Unless (fboundp 'c-mode)
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
151 "c-mode unavailable"
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
152 "comment and parse-partial-sexp tests"
973
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
153 (c-mode)
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
154
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
155 (insert "// comment\n")
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
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
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
158
973
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
159 (let ((point (point)))
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
160 (insert "/* comment */")
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
161 (goto-char point)
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
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
223736d75acb Import from CVS: tag r21-2-45
cvs
parents: 398
diff changeset
164
973
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
165 ;; this last used to crash
ea6a06f7bf2c [xemacs-hg @ 2002-08-22 14:56:23 by stephent]
stephent
parents: 460
diff changeset
166 (parse-partial-sexp point (point-max)))))
3130
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
167
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
168 ;; Test backward-up-list
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
169 ;; Known-Bug: report = Evgeny Zacjev ca 2005-12-01, confirm = Aidan Kehoe
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
170
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
171 (with-temp-buffer
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
172 ;; We are now using the standard syntax table. Thus there's no need to
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
173 ;; worry about a bogus syntax setting, eg, in a Gnus Article buffer the
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
174 ;; bug doesn't manifest.
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
175
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
176 ;; value of point to the immediate left of this character
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
177 ;; 0 1 2
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
178 ;; 1234 56789 012 34567 890 12 3456 7
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
179 (insert "a ( \"b (c\" (\"defg\") \")\") h\n")
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
180
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
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
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
186 (Known-Bug-Expect-Failure
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
187 ;; Evgeny's case
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
188 (Assert (backward-up-list-moves-point-from-to 16 12)))
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
189 (Assert (backward-up-list-moves-point-from-to 19 12))
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
190 (Assert (backward-up-list-moves-point-from-to 20 3))
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
191 (Known-Bug-Expect-Failure
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
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
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
196 (Assert (backward-up-list-moves-point-from-to 24 3))
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
197 ;; This is maybe a little tricky, since we don't expect the position
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
198 ;; check to happen -- so use an illegal expected position
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
199 ;; I don't think there's any other way for this to fail that way,
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
200 ;; barring hardware error....
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
201 (Check-Error-Message syntax-error
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
202 "Unbalanced parentheses"
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
203 (backward-up-list-moves-point-from-to 25 nil))
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
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
a7ef4b25b467 [xemacs-hg @ 2005-12-08 10:58:57 by stephent]
stephent
parents: 1095
diff changeset
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