Mercurial > hg > xemacs-beta
annotate tests/automated/mule-tests.el @ 5328:dae3d95cf319
Merge.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 02 Jan 2011 02:32:59 +0000 |
parents | c096d8051f89 |
children | 8d29f1c4bb98 |
rev | line source |
---|---|
428 | 1 ;; Copyright (C) 1999 Free Software Foundation, Inc. |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
2 ;; Copyright (C) 2010 Ben Wing. |
428 | 3 |
4 ;; Author: Hrvoje Niksic <hniksic@xemacs.org> | |
440 | 5 ;; Maintainers: Hrvoje Niksic <hniksic@xemacs.org>, |
6 ;; Martin Buchholz <martin@xemacs.org> | |
428 | 7 ;; Created: 1999 |
8 ;; Keywords: tests | |
9 | |
10 ;; This file is part of XEmacs. | |
11 | |
12 ;; XEmacs is free software; you can redistribute it and/or modify it | |
13 ;; under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; XEmacs is distributed in the hope that it will be useful, but | |
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 ;; General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
25 ;; 02111-1307, USA. | |
26 | |
27 ;;; Synched up with: Not in FSF. | |
28 | |
29 ;;; Commentary: | |
30 | |
31 ;; Test some Mule functionality (most of these remain to be written) . | |
32 ;; See test-harness.el for instructions on how to run these tests. | |
33 | |
434 | 34 ;; This file will be (read)ed by a non-mule XEmacs, so don't use |
35 ;; literal non-Latin1 characters. Use (make-char) instead. | |
36 | |
3948 | 37 (require 'bytecomp) |
38 | |
428 | 39 ;;----------------------------------------------------------------- |
40 ;; Test whether all legal chars may be safely inserted to a buffer. | |
41 ;;----------------------------------------------------------------- | |
42 | |
43 (defun test-chars (&optional for-test-harness) | |
44 "Insert all characters in a buffer, to see if XEmacs will crash. | |
45 This is done by creating a string with all the legal characters | |
4133 | 46 in [0, 2^21) range, inserting it into the buffer, and checking |
428 | 47 that the buffer's contents are equivalent to the string. |
48 | |
49 If FOR-TEST-HARNESS is specified, a temporary buffer is used, and | |
50 the Assert macro checks for correctness." | |
4133 | 51 (let ((max (expt 2 (if (featurep 'mule) 21 8))) |
428 | 52 (list nil) |
53 (i 0)) | |
54 (while (< i max) | |
55 (and (not for-test-harness) | |
56 (zerop (% i 1000)) | |
57 (message "%d" i)) | |
58 (and (int-char i) | |
59 ;; Don't aset to a string directly because random string | |
60 ;; access is O(n) under Mule. | |
61 (setq list (cons (int-char i) list))) | |
62 (setq i (1+ i))) | |
63 (let ((string (apply #'string (nreverse list)))) | |
64 (if for-test-harness | |
65 ;; For use with test-harness, use Assert and a temporary | |
66 ;; buffer. | |
67 (with-temp-buffer | |
68 (insert string) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
69 (Assert (equal (buffer-string) string))) |
428 | 70 ;; For use without test harness: use a normal buffer, so that |
71 ;; you can also test whether redisplay works. | |
72 (switch-to-buffer (get-buffer-create "test")) | |
73 (erase-buffer) | |
74 (buffer-disable-undo) | |
75 (insert string) | |
76 (assert (equal (buffer-string) string)))))) | |
77 | |
78 ;; It would be really *really* nice if test-harness allowed a way to | |
79 ;; run a test in byte-compiled mode only. It's tedious to have | |
80 ;; time-consuming tests like this one run twice, once interpreted and | |
81 ;; once compiled, for no good reason. | |
82 (test-chars t) | |
434 | 83 |
3439 | 84 (defun unicode-code-point-to-utf-8-string (code-point) |
85 "Convert a Unicode code point to the equivalent UTF-8 string. | |
86 This is a naive implementation in Lisp. " | |
87 (check-argument-type 'natnump code-point) | |
88 (check-argument-range code-point 0 #x1fffff) | |
89 (if (< code-point #x80) | |
90 (format "%c" code-point) | |
91 (if (< code-point #x800) | |
92 (format "%c%c" | |
93 ;; ochars[0] = 0xC0 | (input & ~(0xFFFFF83F)) >> 6; | |
94 (logior #xc0 (lsh (logand code-point #x7c0) -6)) | |
95 ;; ochars[1] = 0x80 | input & ~(0xFFFFFFC0); | |
96 (logior #x80 (logand code-point #x3f))) | |
97 (if (< code-point #x00010000) | |
98 (format "%c%c%c" | |
99 ;; ochars[0] = 0xE0 | (input >> 12) & ~(0xFFFFFFF0); | |
100 (logior #xe0 (logand (lsh code-point -12) #x0f)) | |
101 ;; ochars[1] = 0x80 | (input >> 6) & ~(0xFFFFFFC0); | |
102 (logior #x80 (logand (lsh code-point -6) #x3f)) | |
103 ;; ochars[2] = 0x80 | input & ~(0xFFFFFFC0); | |
104 (logior #x80 (logand code-point #x3f))) | |
105 (if (< code-point #x200000) | |
106 (format "%c%c%c%c" | |
107 ;; ochars[0] = 0xF0 | (input >> 18) & ~(0xFFFFFFF8) | |
108 (logior #xF0 (logand (lsh code-point -18) #x7)) | |
109 ;; ochars[1] = 0x80 | (input >> 12) & ~(0xFFFFFFC0); | |
110 (logior #x80 (logand (lsh code-point -12) #x3f)) | |
111 ;; ochars[2] = 0x80 | (input >> 6) & ~(0xFFFFFFC0); | |
112 (logior #x80 (logand (lsh code-point -6) #x3f)) | |
113 ;; ochars[3] = 0x80 | input & ~(0xFFFFFFC0); | |
114 (logior #x80 (logand code-point #x3f)))))))) | |
115 | |
4026 | 116 ;;---------------------------------------------------------------- |
117 ;; Test that revert-buffer resets the modiff | |
118 ;; Bug reported 2007-06-20 <200706201902.32191.scop@xemacs.org>. | |
119 ;; Fixed 2007-06-22 <18043.2793.611745.734215@parhasard.net>. | |
120 ;;---------------------------------------------------------------- | |
121 | |
4399
e5b3c4dbc8a2
Call #'make-temp-file in mule-tests.el, now it's available.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4318
diff
changeset
|
122 (let ((test-file-name |
e5b3c4dbc8a2
Call #'make-temp-file in mule-tests.el, now it's available.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4318
diff
changeset
|
123 (make-temp-file (expand-file-name "tXfXsKc" (temp-directory)))) |
4026 | 124 revert-buffer-function |
125 kill-buffer-hook) ; paranoia | |
126 (find-file test-file-name) | |
127 (erase-buffer) | |
128 (insert "a string\n") | |
4133 | 129 (Silence-Message (save-buffer 0)) |
4026 | 130 (insert "more text\n") |
131 (revert-buffer t t) | |
132 ;; Just "find-file" with autodetect coding didn't fail for me, but it does | |
133 ;; fail under test harness. Still we'll redo the test with an explicit | |
134 ;; coding system just in case. | |
135 (Assert (not (buffer-modified-p))) | |
136 (kill-buffer nil) | |
137 (when (find-coding-system 'utf-8) | |
138 (find-file test-file-name 'utf-8) | |
139 (insert "more text\n") | |
140 (revert-buffer t t) | |
141 (Assert (not (buffer-modified-p))) | |
142 (kill-buffer nil)) | |
143 (delete-file test-file-name)) | |
144 | |
4647
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
145 (let ((existing-file-name |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
146 (make-temp-file (expand-file-name "k7lCS2Mg" (temp-directory)))) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
147 (nonexistent-file-name |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
148 (make-temp-name (temp-directory)))) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
149 (find-file existing-file-name) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
150 (Assert (not (eq 'undecided |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
151 (coding-system-type buffer-file-coding-system)))) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
152 (kill-buffer nil) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
153 (dolist (coding-system '(utf-8 windows-1251 macintosh big5)) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
154 (when (find-coding-system coding-system) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
155 (find-file existing-file-name coding-system) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
156 (Assert (eq (find-coding-system coding-system) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
157 buffer-file-coding-system)) |
4647
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
158 (kill-buffer nil) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
159 (find-file nonexistent-file-name coding-system) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
160 (Assert (eq (find-coding-system coding-system) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
161 buffer-file-coding-system)) |
4650
8905163c49c5
#'find-file: set b-f-c-s even on error (cf. non-existent files),
Aidan Kehoe <kehoea@parhasard.net>
parents:
4647
diff
changeset
|
162 (set-buffer-modified-p nil) |
4647
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
163 (kill-buffer nil))) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
164 (delete-file existing-file-name)) |
e4ed58cb0e5b
Fix bugs with #'find-file, 0-length files, & coding-system-for-read specified.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4623
diff
changeset
|
165 |
434 | 166 ;;----------------------------------------------------------------- |
167 ;; Test string modification functions that modify the length of a char. | |
168 ;;----------------------------------------------------------------- | |
169 | |
170 (when (featurep 'mule) | |
442 | 171 ;;--------------------------------------------------------------- |
434 | 172 ;; Test fillarray |
442 | 173 ;;--------------------------------------------------------------- |
434 | 174 (macrolet |
175 ((fillarray-test | |
176 (charset1 charset2) | |
177 (let ((char1 (make-char charset1 69)) | |
178 (char2 (make-char charset2 69))) | |
179 `(let ((string (make-string 1000 ,char1))) | |
180 (fillarray string ,char2) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
181 (Assert (eq (aref string 0) ,char2)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
182 (Assert (eq (aref string (1- (length string))) ,char2)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
183 (Assert (eq (length string) 1000)))))) |
434 | 184 (fillarray-test ascii latin-iso8859-1) |
185 (fillarray-test ascii latin-iso8859-2) | |
186 (fillarray-test latin-iso8859-1 ascii) | |
187 (fillarray-test latin-iso8859-2 ascii)) | |
188 | |
189 ;; Test aset | |
190 (let ((string (string (make-char 'ascii 69) (make-char 'latin-iso8859-2 69)))) | |
191 (aset string 0 (make-char 'latin-iso8859-2 42)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
192 (Assert (eq (aref string 1) (make-char 'latin-iso8859-2 69)))) |
434 | 193 |
442 | 194 ;;--------------------------------------------------------------- |
440 | 195 ;; Test coding system functions |
442 | 196 ;;--------------------------------------------------------------- |
440 | 197 |
198 ;; Create alias for coding system without subsidiaries | |
199 (Assert (coding-system-p (find-coding-system 'binary))) | |
200 (Assert (coding-system-canonical-name-p 'binary)) | |
201 (Assert (not (coding-system-alias-p 'binary))) | |
202 (Assert (not (coding-system-alias-p 'mule-tests-alias))) | |
203 (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) | |
204 (Check-Error-Message | |
205 error "Symbol is the canonical name of a coding system and cannot be redefined" | |
206 (define-coding-system-alias 'binary 'iso8859-2)) | |
207 (Check-Error-Message | |
208 error "Symbol is not a coding system alias" | |
209 (coding-system-aliasee 'binary)) | |
210 | |
211 (define-coding-system-alias 'mule-tests-alias 'binary) | |
212 (Assert (coding-system-alias-p 'mule-tests-alias)) | |
213 (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
214 (Assert (eq (get-coding-system 'binary) (get-coding-system 'mule-tests-alias))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
215 (Assert (eq 'binary (coding-system-aliasee 'mule-tests-alias))) |
440 | 216 (Assert (not (coding-system-alias-p 'mule-tests-alias-unix))) |
217 (Assert (not (coding-system-alias-p 'mule-tests-alias-dos))) | |
218 (Assert (not (coding-system-alias-p 'mule-tests-alias-mac))) | |
219 | |
220 (define-coding-system-alias 'mule-tests-alias (get-coding-system 'binary)) | |
221 (Assert (coding-system-alias-p 'mule-tests-alias)) | |
222 (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
223 (Assert (eq (get-coding-system 'binary) (get-coding-system 'mule-tests-alias))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
224 (Assert (eq 'binary (coding-system-aliasee 'mule-tests-alias))) |
440 | 225 (Assert (not (coding-system-alias-p 'mule-tests-alias-unix))) |
226 (Assert (not (coding-system-alias-p 'mule-tests-alias-dos))) | |
227 (Assert (not (coding-system-alias-p 'mule-tests-alias-mac))) | |
228 | |
229 (define-coding-system-alias 'nested-mule-tests-alias 'mule-tests-alias) | |
230 (Assert (coding-system-alias-p 'nested-mule-tests-alias)) | |
231 (Assert (not (coding-system-canonical-name-p 'nested-mule-tests-alias))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
232 (Assert (eq (get-coding-system 'binary) (get-coding-system 'nested-mule-tests-alias))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
233 (Assert (eq (coding-system-aliasee 'nested-mule-tests-alias) 'mule-tests-alias)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
234 (Assert (eq 'mule-tests-alias (coding-system-aliasee 'nested-mule-tests-alias))) |
440 | 235 (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-unix))) |
236 (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-dos))) | |
237 (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-mac))) | |
238 | |
239 (Check-Error-Message | |
240 error "Attempt to create a coding system alias loop" | |
241 (define-coding-system-alias 'mule-tests-alias 'nested-mule-tests-alias)) | |
242 (Check-Error-Message | |
243 error "No such coding system" | |
244 (define-coding-system-alias 'no-such-coding-system 'no-such-coding-system)) | |
245 (Check-Error-Message | |
246 error "Attempt to create a coding system alias loop" | |
247 (define-coding-system-alias 'mule-tests-alias 'mule-tests-alias)) | |
248 | |
249 (define-coding-system-alias 'nested-mule-tests-alias nil) | |
250 (define-coding-system-alias 'mule-tests-alias nil) | |
251 (Assert (coding-system-p (find-coding-system 'binary))) | |
252 (Assert (coding-system-canonical-name-p 'binary)) | |
253 (Assert (not (coding-system-alias-p 'binary))) | |
254 (Assert (not (coding-system-alias-p 'mule-tests-alias))) | |
255 (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) | |
256 (Check-Error-Message | |
257 error "Symbol is the canonical name of a coding system and cannot be redefined" | |
258 (define-coding-system-alias 'binary 'iso8859-2)) | |
259 (Check-Error-Message | |
260 error "Symbol is not a coding system alias" | |
261 (coding-system-aliasee 'binary)) | |
262 | |
263 (define-coding-system-alias 'nested-mule-tests-alias nil) | |
264 (define-coding-system-alias 'mule-tests-alias nil) | |
265 | |
266 ;; Create alias for coding system with subsidiaries | |
267 (define-coding-system-alias 'mule-tests-alias 'iso-8859-7) | |
268 (Assert (coding-system-alias-p 'mule-tests-alias)) | |
269 (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
270 (Assert (eq (get-coding-system 'iso-8859-7) (get-coding-system 'mule-tests-alias))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
271 (Assert (eq 'iso-8859-7 (coding-system-aliasee 'mule-tests-alias))) |
440 | 272 (Assert (coding-system-alias-p 'mule-tests-alias-unix)) |
273 (Assert (coding-system-alias-p 'mule-tests-alias-dos)) | |
274 (Assert (coding-system-alias-p 'mule-tests-alias-mac)) | |
275 | |
276 (define-coding-system-alias 'mule-tests-alias (get-coding-system 'iso-8859-7)) | |
277 (Assert (coding-system-alias-p 'mule-tests-alias)) | |
278 (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
279 (Assert (eq (get-coding-system 'iso-8859-7) (get-coding-system 'mule-tests-alias))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
280 (Assert (eq 'iso-8859-7 (coding-system-aliasee 'mule-tests-alias))) |
440 | 281 (Assert (coding-system-alias-p 'mule-tests-alias-unix)) |
282 (Assert (coding-system-alias-p 'mule-tests-alias-dos)) | |
283 (Assert (coding-system-alias-p 'mule-tests-alias-mac)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
284 (Assert (eq (find-coding-system 'mule-tests-alias-mac) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
285 (find-coding-system 'iso-8859-7-mac))) |
440 | 286 |
287 (define-coding-system-alias 'nested-mule-tests-alias 'mule-tests-alias) | |
288 (Assert (coding-system-alias-p 'nested-mule-tests-alias)) | |
289 (Assert (not (coding-system-canonical-name-p 'nested-mule-tests-alias))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
290 (Assert (eq (get-coding-system 'iso-8859-7) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
291 (get-coding-system 'nested-mule-tests-alias))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
292 (Assert (eq (coding-system-aliasee 'nested-mule-tests-alias) 'mule-tests-alias)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
293 (Assert (eq 'mule-tests-alias (coding-system-aliasee 'nested-mule-tests-alias))) |
440 | 294 (Assert (coding-system-alias-p 'nested-mule-tests-alias-unix)) |
295 (Assert (coding-system-alias-p 'nested-mule-tests-alias-dos)) | |
296 (Assert (coding-system-alias-p 'nested-mule-tests-alias-mac)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
297 (Assert (eq (find-coding-system 'nested-mule-tests-alias-unix) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
298 (find-coding-system 'iso-8859-7-unix))) |
440 | 299 |
300 (Check-Error-Message | |
301 error "Attempt to create a coding system alias loop" | |
302 (define-coding-system-alias 'mule-tests-alias 'nested-mule-tests-alias)) | |
303 (Check-Error-Message | |
304 error "No such coding system" | |
305 (define-coding-system-alias 'no-such-coding-system 'no-such-coding-system)) | |
306 (Check-Error-Message | |
307 error "Attempt to create a coding system alias loop" | |
308 (define-coding-system-alias 'mule-tests-alias 'mule-tests-alias)) | |
309 | |
310 ;; Test dangling alias deletion | |
311 (define-coding-system-alias 'mule-tests-alias nil) | |
312 (Assert (not (coding-system-alias-p 'mule-tests-alias))) | |
313 (Assert (not (coding-system-alias-p 'mule-tests-alias-unix))) | |
314 (Assert (not (coding-system-alias-p 'nested-mule-tests-alias))) | |
315 (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-dos))) | |
316 | |
442 | 317 ;;--------------------------------------------------------------- |
438 | 318 ;; Test strings waxing and waning across the 8k BIG_STRING limit (see alloc.c) |
442 | 319 ;;--------------------------------------------------------------- |
438 | 320 (defun charset-char-string (charset) |
2026 | 321 (let (lo hi string n (gc-cons-threshold most-positive-fixnum)) |
438 | 322 (if (= (charset-chars charset) 94) |
323 (setq lo 33 hi 126) | |
324 (setq lo 32 hi 127)) | |
325 (if (= (charset-dimension charset) 1) | |
326 (progn | |
327 (setq string (make-string (1+ (- hi lo)) ??)) | |
328 (setq n 0) | |
329 (loop for j from lo to hi do | |
330 (progn | |
331 (aset string n (make-char charset j)) | |
332 (incf n))) | |
2026 | 333 (garbage-collect) |
438 | 334 string) |
335 (progn | |
336 (setq string (make-string (* (1+ (- hi lo)) (1+ (- hi lo))) ??)) | |
337 (setq n 0) | |
338 (loop for j from lo to hi do | |
339 (loop for k from lo to hi do | |
340 (progn | |
341 (aset string n (make-char charset j k)) | |
342 (incf n)))) | |
2026 | 343 (garbage-collect) |
438 | 344 string)))) |
345 | |
346 ;; The following two used to crash xemacs! | |
347 (Assert (charset-char-string 'japanese-jisx0208)) | |
348 (aset (make-string 9003 ??) 1 (make-char 'latin-iso8859-1 77)) | |
349 | |
350 (let ((greek-string (charset-char-string 'greek-iso8859-7)) | |
351 (string (make-string (* 96 60) ??))) | |
352 (loop for j from 0 below (length string) do | |
353 (aset string j (aref greek-string (mod j 96)))) | |
354 (loop for k in '(0 1 58 59) do | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
355 (Assert (equal (substring string (* 96 k) (* 96 (1+ k))) greek-string)))) |
438 | 356 |
357 (let ((greek-string (charset-char-string 'greek-iso8859-7)) | |
358 (string (make-string (* 96 60) ??))) | |
359 (loop for j from (1- (length string)) downto 0 do | |
360 (aset string j (aref greek-string (mod j 96)))) | |
361 (loop for k in '(0 1 58 59) do | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
362 (Assert (equal (substring string (* 96 k) (* 96 (1+ k))) greek-string)))) |
438 | 363 |
364 (let ((ascii-string (charset-char-string 'ascii)) | |
365 (string (make-string (* 94 60) (make-char 'greek-iso8859-7 57)))) | |
366 (loop for j from 0 below (length string) do | |
367 (aset string j (aref ascii-string (mod j 94)))) | |
368 (loop for k in '(0 1 58 59) do | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
369 (Assert (equal (substring string (* 94 k) (+ 94 (* 94 k))) ascii-string)))) |
438 | 370 |
371 (let ((ascii-string (charset-char-string 'ascii)) | |
372 (string (make-string (* 94 60) (make-char 'greek-iso8859-7 57)))) | |
373 (loop for j from (1- (length string)) downto 0 do | |
374 (aset string j (aref ascii-string (mod j 94)))) | |
375 (loop for k in '(0 1 58 59) do | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
376 (Assert (equal (substring string (* 94 k) (* 94 (1+ k))) ascii-string)))) |
438 | 377 |
442 | 378 ;;--------------------------------------------------------------- |
5107
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
379 ;; Test string character conversion |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
380 ;;--------------------------------------------------------------- |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
381 |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
382 ;; #### This should test all coding systems! |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
383 |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
384 (let ((all-octets (let ((s (make-string 256 ?\000))) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
385 (loop for i from (1- (length s)) downto 0 do |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
386 (aset s i (int-char i))) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
387 s)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
388 (escape-quoted-result (let ((schar '(27 155 142 143 14 15)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
389 (s (make-string 262 ?\000)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
390 (pos 0)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
391 (loop for ord from 0 to 255 do |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
392 (when (member ord schar) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
393 (aset s pos ?\033) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
394 (incf pos)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
395 (aset s pos (int-char ord)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
396 (incf pos)) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
397 s))) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
398 (Assert (string= (encode-coding-string all-octets 'escape-quoted) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
399 escape-quoted-result))) |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
400 |
ae4ddcdf30c0
Test escape-quoted for the range U+0000 to U+00FF.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4957
diff
changeset
|
401 ;;--------------------------------------------------------------- |
442 | 402 ;; Test file-system character conversion (and, en passant, file ops) |
403 ;;--------------------------------------------------------------- | |
3970 | 404 (let* ((dstroke (make-char 'latin-iso8859-2 80)) |
405 (latin2-string (make-string 4 dstroke)) | |
597 | 406 (prefix (concat (file-name-as-directory |
407 (file-truename (temp-directory))) | |
408 latin2-string)) | |
2026 | 409 (file-name-coding-system |
410 ;; 'iso-8859-X doesn't work on darwin (as of "Panther" 10.3), it | |
411 ;; seems to know that file-name-coding-system is definitely utf-8 | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4731
diff
changeset
|
412 (if (or (string-match "darwin" system-configuration) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4731
diff
changeset
|
413 (featurep 'cygwin-use-utf-8)) |
2026 | 414 'utf-8 |
415 'iso-8859-2)) | |
3970 | 416 ;; make-temp-name does stat(), which on OS X requires that you |
417 ;; normalise, where open() will normalise for you. Previously we | |
418 ;; used scaron as the Latin-2 character, and make-temp-name errored | |
3976 | 419 ;; on OS X. LATIN CAPITAL LETTER D WITH STROKE does not decompose. |
3970 | 420 (name1 (make-temp-name prefix)) |
4465
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
421 (name2 (make-temp-name prefix)) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
422 (name3 (make-temp-name prefix)) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
423 working-symlinks) |
3472 | 424 (Assert (not (equal name1 name2))) |
425 (Assert (not (file-exists-p name1))) | |
4465
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
426 ;; This is how you suppress output from `message', called by `write-region' |
3472 | 427 (Silence-Message |
428 (write-region (point-min) (point-max) name1)) | |
429 (Assert (file-exists-p name1)) | |
4465
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
430 (Silence-Message |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
431 (write-region (point-min) (point-max) name3)) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
432 (Assert (file-exists-p name3)) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
433 (condition-case nil |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
434 (make-symbolic-link name1 name3) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
435 (file-already-exists |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
436 ;; If we actually have functioning symlinks, we end up here, since |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
437 ;; name3 already exists and OK-IF-ALREADY-EXISTS was not specified. |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
438 (setq working-symlinks t))) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
439 (when working-symlinks |
3472 | 440 (make-symbolic-link name1 name2) |
441 (Assert (file-exists-p name2)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
442 (Assert (equal (file-truename name2) name1)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
443 (Assert (equal (file-truename name1) name1))) |
4465
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
444 (ignore-file-errors (delete-file name1)) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
445 (ignore-file-errors (delete-file name2)) |
732b87cfabf2
Document Win32 symlink behaviour; adjust tests to take it into a/c.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4399
diff
changeset
|
446 (ignore-file-errors (delete-file name3))) |
442 | 447 |
448 ;; Add many more file operation tests here... | |
449 | |
450 ;;--------------------------------------------------------------- | |
451 ;; Test Unicode-related functions | |
452 ;;--------------------------------------------------------------- | |
4861 | 453 (let* ((scaron (make-char 'latin-iso8859-2 57))) |
875 | 454 ;; Used to try #x0000, but you can't change ASCII or Latin-1 |
4715
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
455 (loop |
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
456 for code in '(#x0100 #x2222 #x4444 #xffff) |
4861 | 457 with initial-unicode = (char-to-unicode scaron) |
4715
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
458 do |
442 | 459 (progn |
4861 | 460 (set-unicode-conversion scaron code) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
461 (Assert (eq code (char-to-unicode scaron))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
462 (Assert (eq scaron (unicode-to-char code '(latin-iso8859-2))))) |
4861 | 463 finally (set-unicode-conversion scaron initial-unicode)) |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5136
diff
changeset
|
464 (Check-Error args-out-of-range (set-unicode-conversion scaron -10000))) |
1195 | 465 |
3439 | 466 (dolist (utf-8-char |
467 '("\xc6\x92" ;; U+0192 LATIN SMALL LETTER F WITH HOOK | |
468 "\xe2\x81\x8a" ;; U+204A TIRONIAN SIGN ET | |
469 "\xe2\x82\xae" ;; U+20AE TUGRIK SIGN | |
470 "\xf0\x9d\x92\xbd" ;; U+1D4BD MATHEMATICAL SCRIPT SMALL H | |
471 "\xf0\x9d\x96\x93" ;; U+1D593 MATHEMATICAL BOLD FRAKTUR SMALL N | |
472 "\xf0\xaf\xa8\x88" ;; U+2FA08 CJK COMPATIBILITY FOR U+4BCE | |
473 "\xf4\x8f\xbf\xbd")) ;; U+10FFFD <Plane 16 Private Use, Last> | |
474 (let* ((xemacs-character (car (append | |
475 (decode-coding-string utf-8-char 'utf-8) | |
476 nil))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
477 (xemacs-charset (car (split-char xemacs-character)))) |
3439 | 478 |
479 ;; Trivial test of the UTF-8 support of the escape-quoted character set. | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
480 (Assert (equal (decode-coding-string utf-8-char 'utf-8) |
3439 | 481 (decode-coding-string (concat "\033%G" utf-8-char) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
482 'escape-quoted))) |
3439 | 483 |
484 ;; Check that the reverse mapping holds. | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
485 (Assert (equal (unicode-code-point-to-utf-8-string |
3439 | 486 (encode-char xemacs-character 'ucs)) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
487 utf-8-char)) |
3439 | 488 |
489 ;; Check that, if this character has been JIT-allocated, it is encoded | |
490 ;; in escape-quoted using the corresponding UTF-8 escape. | |
491 (when (charset-property xemacs-charset 'encode-as-utf-8) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
492 (Assert (equal (concat "\033%G" utf-8-char) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
493 (encode-coding-string xemacs-character 'escape-quoted))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
494 (Assert (equal (concat "\033%G" utf-8-char) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
495 (encode-coding-string xemacs-character 'ctext)))))) |
3439 | 496 |
3952 | 497 (loop |
4583
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
498 for (code-point utf-16-big-endian utf-16-little-endian) |
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
499 in '((#x10000 "\xd8\x00\xdc\x00" "\x00\xd8\x00\xdc") |
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
500 (#x10FFFD "\xdb\xff\xdf\xfd" "\xff\xdb\xfd\xdf")) |
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
501 do |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
502 (Assert (equal (encode-coding-string |
4583
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
503 (decode-char 'ucs code-point) 'utf-16) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
504 utf-16-big-endian)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
505 (Assert (equal (encode-coding-string |
4583
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
506 (decode-char 'ucs code-point) 'utf-16-le) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
507 utf-16-little-endian))) |
4583
2669b1b7e33b
Correct little-endian UTF-16 surrogate handling.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4495
diff
changeset
|
508 |
3952 | 509 |
1195 | 510 ;;--------------------------------------------------------------- |
3690 | 511 ;; Regression test for a couple of CCL-related bugs. |
512 ;;--------------------------------------------------------------- | |
513 | |
514 (let ((ccl-vector [0 0 0 0 0 0 0 0 0])) | |
515 (define-ccl-program ccl-write-two-control-1-chars | |
516 `(1 | |
517 ((r0 = ,(charset-id 'control-1)) | |
518 (r1 = 0) | |
519 (write-multibyte-character r0 r1) | |
520 (r1 = 31) | |
521 (write-multibyte-character r0 r1))) | |
522 "CCL program that writes two control-1 multibyte characters.") | |
523 | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
524 (Assert (equal |
3690 | 525 (ccl-execute-on-string 'ccl-write-two-control-1-chars |
526 ccl-vector "") | |
527 (format "%c%c" (make-char 'control-1 0) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
528 (make-char 'control-1 31)))) |
3690 | 529 |
530 (define-ccl-program ccl-unicode-two-control-1-chars | |
531 `(1 | |
532 ((r0 = ,(charset-id 'control-1)) | |
533 (r1 = 31) | |
534 (mule-to-unicode r0 r1) | |
535 (r4 = r0) | |
536 (r3 = ,(charset-id 'control-1)) | |
537 (r2 = 0) | |
538 (mule-to-unicode r3 r2))) | |
539 "CCL program that writes two control-1 UCS code points in r3 and r4") | |
540 | |
541 ;; Re-initialise the vector, mainly to clear the instruction counter, | |
542 ;; which is its last element. | |
543 (setq ccl-vector [0 0 0 0 0 0 0 0 0]) | |
544 | |
545 (ccl-execute-on-string 'ccl-unicode-two-control-1-chars ccl-vector "") | |
546 | |
547 (Assert (and (eq (aref ccl-vector 3) | |
548 (encode-char (make-char 'control-1 0) 'ucs)) | |
549 (eq (aref ccl-vector 4) | |
550 (encode-char (make-char 'control-1 31) 'ucs))))) | |
551 | |
4295 | 552 |
553 ;; Test the 8 bit fixed-width coding systems for round-trip | |
554 ;; compatibility with themselves. | |
555 (loop | |
556 for coding-system in (coding-system-list) | |
557 with all-possible-octets = (apply #'string | |
558 (loop for i from ?\x00 to ?\xFF | |
559 collect i)) | |
560 do | |
4690
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4688
diff
changeset
|
561 (when (and (eq 'fixed-width (coding-system-type coding-system)) |
4715
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
562 ;; Don't check the coding systems with odd line endings |
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
563 ;; (maybe we should): |
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
564 (eq 'lf (coding-system-eol-type coding-system))) |
4295 | 565 ;; These coding systems are round-trip compatible with themselves. |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
566 (Assert (equal (encode-coding-string |
4295 | 567 (decode-coding-string all-possible-octets |
568 coding-system) | |
569 coding-system) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
570 all-possible-octets) |
4715
a357478dd457
Fix some test failures, mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4690
diff
changeset
|
571 (format "checking %s is transparent" coding-system)))) |
4295 | 572 |
3690 | 573 ;;--------------------------------------------------------------- |
1195 | 574 ;; Test charset-in-* functions |
575 ;;--------------------------------------------------------------- | |
576 (with-temp-buffer | |
577 (insert-file-contents (locate-data-file "HELLO")) | |
4884
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
578 (let ((sorted-charsets-in-HELLO |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
579 '(arabic-iso8859-6 ascii chinese-big5-1 chinese-gb2312 |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
580 cyrillic-iso8859-5 ethiopic greek-iso8859-7 |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
581 hebrew-iso8859-8 japanese-jisx0208 japanese-jisx0212 |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
582 katakana-jisx0201 korean-ksc5601 latin-iso8859-1 |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
583 latin-iso8859-2 vietnamese-viscii-lower))) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
584 (Assert (equal |
4884
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
585 ;; The sort is to make the algorithm of charsets-in-region |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
586 ;; irrelevant. |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
587 (sort (charsets-in-region (point-min) (point-max)) |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
588 #'string<) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
589 sorted-charsets-in-HELLO)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
590 (Assert (equal |
4884
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
591 (sort (charsets-in-string (buffer-substring (point-min) |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
592 (point-max))) |
29fb3baea939
Fix the bugs necessary to resolve the trivial test failures in mule-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents:
4861
diff
changeset
|
593 #'string<) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
594 sorted-charsets-in-HELLO)))) |
3948 | 595 |
4133 | 596 ;;--------------------------------------------------------------- |
597 ;; Language environments, and whether the specified values are sane. | |
598 ;;--------------------------------------------------------------- | |
599 (loop | |
600 for language in (mapcar #'car language-info-alist) | |
601 with language-input-method = nil | |
4305 | 602 with native-coding-system = nil |
4672
938ffa3ffe4d
Revert to original language environment, tests/automated/mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4650
diff
changeset
|
603 with original-language-environment = current-language-environment |
4133 | 604 do |
605 ;; s-l-e can call #'require, which says "Loading ..." | |
606 (Silence-Message (set-language-environment language)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
607 (Assert (equal language current-language-environment)) |
4133 | 608 |
609 (setq language-input-method | |
610 (get-language-info language 'input-method)) | |
611 (when (and language-input-method | |
612 ;; #### Not robust, if more input methods besides canna are | |
613 ;; in core. The intention of this is that if *any* of the | |
614 ;; packages' input methods are available, we check that *all* | |
615 ;; of the language environments' input methods actually | |
616 ;; exist, which goes against the spirit of non-monolithic | |
617 ;; packages. But I don't have a better approach to this. | |
618 (> (length input-method-alist) 1)) | |
619 (Assert (assoc language-input-method input-method-alist)) | |
620 (Skip-Test-Unless | |
621 (assoc language-input-method input-method-alist) | |
622 "input method unavailable" | |
623 (format "check that IM %s can be activated" language-input-method) | |
624 ;; s-i-m can load files. | |
625 (Silence-Message | |
626 (set-input-method language-input-method)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
5107
diff
changeset
|
627 (Assert (equal language-input-method current-input-method)))) |
4133 | 628 |
3970 | 629 (dolist (charset (get-language-info language 'charset)) |
630 (Assert (charsetp (find-charset charset)))) | |
631 (dolist (coding-system (get-language-info language 'coding-system)) | |
632 (Assert (coding-system-p (find-coding-system coding-system)))) | |
4305 | 633 (dolist (coding-system |
634 (if (listp (setq native-coding-system | |
635 (get-language-info language | |
636 'native-coding-system))) | |
637 native-coding-system | |
638 (list native-coding-system))) | |
4133 | 639 ;; We don't have the appropriate POSIX locales to test with a |
640 ;; native-coding-system that is a function. | |
641 (unless (functionp coding-system) | |
4672
938ffa3ffe4d
Revert to original language environment, tests/automated/mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4650
diff
changeset
|
642 (Assert (coding-system-p (find-coding-system coding-system))))) |
938ffa3ffe4d
Revert to original language environment, tests/automated/mule-tests.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4650
diff
changeset
|
643 finally (set-language-environment original-language-environment)) |
3970 | 644 |
3948 | 645 (with-temp-buffer |
646 (flet | |
647 ((Assert-elc-is-escape-quoted () | |
648 "Assert the current buffer has an escape-quoted cookie if compiled." | |
649 (save-excursion | |
4623
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
650 (let* ((temporary-file-name (make-temp-name |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
651 (expand-file-name "zjPQ2Pk" |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
652 (temp-directory)))) |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
653 (byte-compile-result (byte-compile-from-buffer |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
654 (current-buffer) temporary-file-name |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
655 nil))) |
4133 | 656 (Assert (string-match |
657 "^;;;###coding system: escape-quoted" | |
658 (buffer-substring nil nil byte-compile-result)))))) | |
3948 | 659 (Assert-elc-has-no-specified-encoding () |
660 "Assert the current buffer has no coding cookie if compiled." | |
661 (save-excursion | |
4623
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
662 (let* ((temporary-file-name (make-temp-name |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
663 (expand-file-name "zjPQ2Pk" |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
664 (temp-directory)))) |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
665 (byte-compile-result (byte-compile-from-buffer |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
666 (current-buffer) temporary-file-name |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
667 nil))) |
3948 | 668 (Assert (not (string-match |
669 ";;;###coding system:" | |
4133 | 670 (buffer-substring nil nil |
671 byte-compile-result)))))))) | |
3948 | 672 (insert |
4133 | 673 ;; Create a buffer with Unicode escapes. The #'read call is at |
674 ;; runtime, because this file may be compiled and read in a non-Mule | |
675 ;; XEmacs. (But it won't be run.) | |
676 (read | |
677 "#r\" (defvar testing-mule-compilation-handling | |
678 (string ?\\u371E ;; kDefinition beautiful; pretty, used | |
3948 | 679 ;; in girl's name |
4133 | 680 ?\\U0002A6A9 ;; kDefinition (Cant.) sound of shouting |
681 ?\\U0002A65B ;; kDefinition (Cant.) decayed teeth; | |
3948 | 682 ;; tongue-tied |
4133 | 683 ?\\U00010400 ;; DESERET CAPITAL LETTER LONG I |
684 ?\\u3263)) ;; CIRCLED HANGUL RIEUL \"")) | |
3948 | 685 |
686 (Assert-elc-is-escape-quoted) | |
687 (delete-region (point-min) (point-max)) | |
688 | |
689 (insert | |
690 ;; This time, the buffer will contain the actual characters, because of | |
691 ;; u flag to the #r. | |
4133 | 692 (read |
693 "#ru\" (defvar testing-mule-compilation-handling | |
694 (string ?\\u371E ;; kDefinition beautiful; pretty, used | |
3948 | 695 ;; in girl's name |
4133 | 696 ?\\U0002A6A9 ;; kDefinition (Cant.) sound of shouting |
697 ?\\U0002A65B ;; kDefinition (Cant.) decayed teeth; | |
3948 | 698 ;; tongue-tied |
4133 | 699 ?\\U00010400 ;; DESERET CAPITAL LETTER LONG I |
700 ?\\u3263)) ;; CIRCLED HANGUL RIEUL \"")) | |
3948 | 701 |
702 (Assert-elc-is-escape-quoted) | |
703 (delete-region (point-min) (point-max)) | |
704 | |
705 (insert | |
706 ;; Just a single four character escape. | |
4133 | 707 (read |
708 "#r\" (defvar testing-mule-compilation-handling | |
709 (string ?\\u371E)) ;; kDefinition beautiful; pretty, used\"")) | |
3948 | 710 |
711 (Assert-elc-is-escape-quoted) | |
712 (delete-region (point-min) (point-max)) | |
713 | |
714 (insert | |
715 ;; Just a single eight character escape. | |
4133 | 716 (read |
717 "#r\" (defvar testing-mule-compilation-handling | |
718 (string ?\\U0002A65B)) ;; kDefinition (Cant.) decayed teeth;\"")) | |
3948 | 719 |
720 (Assert-elc-is-escape-quoted) | |
721 (delete-region (point-min) (point-max)) | |
722 | |
723 (insert | |
4133 | 724 ;; A single latin-1 hex digit escape No run-time #'read call, |
725 ;; non-Mule can handle this too. | |
3948 | 726 #r" (defvar testing-mule-compilation-handling |
4133 | 727 (string ?\xab)) ;; LEFT-POINTING DOUBLE ANGLE QUOTATION MARK") |
728 | |
729 (Assert-elc-has-no-specified-encoding) | |
730 (delete-region (point-min) (point-max)) | |
731 | |
732 (insert | |
733 ;; A single latin-1 character. No run-time #'read call. | |
734 #ru" (defvar testing-mule-compilation-handling | |
735 (string ?\u00AB)) ;; LEFT-POINTING DOUBLE ANGLE QUOTATION MARK\")") | |
3948 | 736 |
737 (Assert-elc-has-no-specified-encoding) | |
738 (delete-region (point-min) (point-max)) | |
739 | |
740 (insert | |
4133 | 741 ;; Just ASCII. No run-time #'read call |
742 #r" (defvar testing-mule-compilation-handling | |
743 (string ?A)) ;; LATIN CAPITAL LETTER A") | |
3948 | 744 |
745 (Assert-elc-has-no-specified-encoding) | |
746 (delete-region (point-min) (point-max)) | |
747 | |
4623
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
748 ;; There used to be a bug here because the coding-cookie insertion code |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
749 ;; looks at the input buffer, not the output buffer. |
4133 | 750 ;; |
751 ;; It looks at the input buffer because byte-compile-dynamic and | |
752 ;; byte-compile-dynamic-docstrings currently need to be | |
753 ;; unconditionally turned off for Mule files, since dynamic | |
754 ;; compilation of function bodies and docstrings fails if you can't | |
755 ;; call (point) and trivially get the byte offset in the file. | |
756 ;; | |
4623
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
757 ;; And to unconditionally turn those two features off, you need to know |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
758 ;; before byte-compilation whether the byte-compilation output file |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
759 ;; contains non-Latin-1 characters. Or to check after compilation and |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
760 ;; redo; the latter is what we do right now. This will only be necessary |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
761 ;; in a very small minority of cases, it's not a performance-critical |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
762 ;; issue. |
4133 | 763 ;; |
4623
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
764 ;; Martin Buchholz thinks, in bytecomp.el, that we should implement lazy |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
765 ;; loading for Mule files; I (Aidan Kehoe) don't think that's worth the |
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
766 ;; effort today (February 2009). |
3948 | 767 (insert |
4133 | 768 "(defvar testing-mule-compilation-handling (eval-when-compile |
769 (decode-char 'ucs #x371e))) ;; kDefinition beautiful; pretty, used\"") | |
4623
a9f83990e6bf
Fix a byte compiler bug with characters above ?\xFF.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4620
diff
changeset
|
770 (Assert-elc-is-escape-quoted) |
3948 | 771 (delete-region (point-min) (point-max)))) |
4318
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
772 |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
773 (Known-Bug-Expect-Error |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
774 invalid-constant |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
775 (loop |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
776 for i from #x0 to #x10FFFF |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
777 with exceptions = #s(range-table type start-closed-end-closed |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
778 data ((#xFFFE #xFFFF) t |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
779 (#xFDD0 #xFDEF) t |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
780 (#xD800 #xDBFF) t |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
781 (#xDC00 #xDFFF) t)) |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
782 do (unless (get-range-table i exceptions) |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
783 (read (format (if (> i #xFFFF) #r"?\U%08X" #r"?\u%04X") i))) |
4d0f773d5e21
Fix the test failures introduced by the non-ISO-2022 coding systems.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4305
diff
changeset
|
784 finally return t)) |
4688
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
785 (loop |
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
786 for i from #x00 to #xff |
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
787 do (Assert |
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
788 (= 1 (length (decode-coding-string (format "%c" i) 'utf-8-unix))) |
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
789 (format |
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
790 "checking Unicode coding systems behave well with short input, %02X" |
7e54adf407a1
Fix a bug with Unicode error sequences and very short input strings.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4672
diff
changeset
|
791 i))) |
4731
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
792 |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
793 ;;--------------------------------------------------------------- |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
794 ;; Process tests |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
795 ;; #### Should do network too. |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
796 ;;--------------------------------------------------------------- |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
797 (Skip-Test-Unless (and (file-exists-p "/dev/null") |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
798 (fboundp 'executable-find) |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
799 (executable-find "cat")) |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
800 "cat(1) or /dev/null missing" |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
801 "Test that default-process-coding-system can be nil." |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
802 (with-temp-buffer |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
803 (Assert (let (default-process-coding-system) |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
804 (shell-command "cat </dev/null >/dev/null") |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
805 t)))) |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
806 |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
807 ) ; end of tests that require MULE built in. |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
808 |
ad40dc9d3a97
Add test of nil binding of default-process-coding-system.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4715
diff
changeset
|
809 ;;; end of mule-tests.el |