annotate tests/automated/query-coding-tests.el @ 5003:6b6b0f8ab749

#'union doesn't preserve relative order; use #'delete-duplicates instead. 2010-02-07 Aidan Kehoe <kehoea@parhasard.net> * setup-paths.el (paths-find-emacs-roots) (paths-construct-info-path): * packages.el (packages-find-installation-package-directories): #'union doesn't guarantee that it will preserve the relative order of elements in its arguments; use #'delete-duplicates instead. Thank you for the bug reports, Robert Pluim, Stephen Turnbull.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 07 Feb 2010 14:37:35 +0000
parents 189fb67ca31a
children 0f66906b6e37
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
1 ;; Copyright (C) 2008 Free Software Foundation, Inc. -*- coding: iso-8859-1 -*-
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
2
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
3 ;; Author: Aidan Kehoe <kehoea@parhasard.net>
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
4 ;; Maintainer: Aidan Kehoe <kehoea@parhasard.net>
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
5 ;; Created: 2008
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
6 ;; Keywords: tests, query-coding-region
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
7
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
8 ;; This file is part of XEmacs.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
9
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
13 ;; any later version.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
14
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
18 ;; General Public License for more details.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
19
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
23 ;; 02111-1307, USA.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
24
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
25 ;;; Synched up with: Not in FSF.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
26
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
27 ;;; Commentary:
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
28
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
29 ;; Test the query-coding-region and query-coding-string implementations for
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
30 ;; some well-known coding systems.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
31
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
32 (require 'bytecomp)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
33
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
34 (when (featurep 'mule)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
35 (let ((ascii-chars-string (apply #'string
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
36 (loop for i from #x0 to #x7f
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
37 collect (int-to-char i))))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
38 (latin-1-chars-string (apply #'string
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
39 (loop for i from #x0 to #xff
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
40 collect (int-to-char i))))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
41 unix-coding-system text-conversion-error-signalled)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
42 (with-temp-buffer
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
43 (insert ascii-chars-string)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
44 ;; First, check all the coding systems that are ASCII-transparent for
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
45 ;; ASCII-transparency in query-coding-region.
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
46 (dolist (coding-system
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
47 (delete-duplicates
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
48 (mapcar #'(lambda (coding-system)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
49 (unless (coding-system-alias-p coding-system)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
50 ;; We're only interested in the version with
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
51 ;; Unix line endings right now.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
52 (setq unix-coding-system
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
53 (subsidiary-coding-system
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
54 (coding-system-base coding-system) 'lf))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
55 (when (and
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
56 ;; ASCII-transparent
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
57 (equal ascii-chars-string
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
58 (encode-coding-string
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
59 ascii-chars-string
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
60 unix-coding-system))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
61 (not
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
62 (memq (coding-system-type
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
63 unix-coding-system)
4690
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4622
diff changeset
64 '(undecided chain
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4622
diff changeset
65 ;; #### We should be
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4622
diff changeset
66 ;; testing these too.
257b468bf2ca Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4622
diff changeset
67 mswindows-multibyte))))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
68 unix-coding-system)))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
69 (coding-system-list nil))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
70 :test #'eq))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
71 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
72 (query-coding-region (point-min) (point-max) coding-system)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
73 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
74 (format "checking query-coding-region ASCII-transparency, %s"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
75 coding-system))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
76 (Assert (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
77 (format "checking query-coding-region ASCII-transparency, %s"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
78 coding-system)))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
79 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
80 (query-coding-string ascii-chars-string coding-system)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
81 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
82 (format "checking query-coding-string ASCII-transparency, %s"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
83 coding-system))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
84 (Assert (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
85 (format "checking query-coding-string ASCII-transparency, %s"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
86 coding-system))))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
87 (delete-region (point-min) (point-max))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
88 ;; Check for success from the two Latin-1 coding systems
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
89 (insert latin-1-chars-string)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
90 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
91 (query-coding-region (point-min) (point-max) 'iso-8859-1-unix)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
92 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
93 "checking query-coding-region iso-8859-1-transparency")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
94 (Assert (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
95 "checking query-coding-region iso-8859-1-transparency"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
96 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
97 (query-coding-string (buffer-string) 'iso-8859-1-unix)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
98 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
99 "checking query-coding-string iso-8859-1-transparency")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
100 (Assert (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
101 "checking query-coding-string iso-8859-1-transparency"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
102 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
103 (query-coding-string (buffer-string) 'iso-latin-1-with-esc-unix)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
104 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
105 "checking query-coding-region iso-latin-1-with-esc-transparency")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
106 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
107 (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
108 "checking query-coding-region iso-latin-1-with-esc-transparency"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
109 ;; Make it fail, check that it fails correctly
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
110 (insert (decode-char 'ucs #x20AC)) ;; EURO SIGN
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
111 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
112 (query-coding-region (point-min) (point-max) 'iso-8859-1-unix)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
113 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
114 (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
115 "checking that query-coding-region fails, U+20AC, iso-8859-1")
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
116 (Assert-equal query-coding-table
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
117 #s(range-table type start-closed-end-open data
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
118 ((257 258) unencodable))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
119 "checking query-coding-region fails correctly, U+20AC, iso-8859-1"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
120 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
121 (query-coding-region (point-min) (point-max)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
122 'iso-latin-1-with-esc-unix)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
123 ;; Stupidly, this succeeds. The behaviour is compatible with
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
124 ;; GNU, though, and we encourage people not to use
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
125 ;; iso-latin-1-with-esc-unix anyway:
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
126 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
127 query-coding-succeeded
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
128 "checking that query-coding-region succeeds, U+20AC, \
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
129 iso-latin-with-esc-unix-1")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
130 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
131 (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
132 "checking that query-coding-region succeeds, U+20AC, \
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
133 iso-latin-with-esc-unix-1"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
134 ;; Check that it errors correctly.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
135 (setq text-conversion-error-signalled nil)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
136 (condition-case nil
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
137 (query-coding-region (point-min) (point-max) 'iso-8859-1-unix
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
138 (current-buffer) nil t)
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
139 (text-conversion-error
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
140 (setq text-conversion-error-signalled t)))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
141 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
142 text-conversion-error-signalled
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
143 "checking query-coding-region signals text-conversion-error correctly")
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
144 (setq text-conversion-error-signalled nil)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
145 (condition-case nil
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
146 (query-coding-region (point-min) (point-max)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
147 'iso-latin-1-with-esc-unix nil nil t)
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
148 (text-conversion-error
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
149 (setq text-conversion-error-signalled t)))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
150 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
151 (null text-conversion-error-signalled)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
152 "checking query-coding-region doesn't signal text-conversion-error")
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
153 (delete-region (point-min) (point-max))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
154 (insert latin-1-chars-string)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
155 (decode-coding-region (point-min) (point-max) 'windows-1252-unix)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
156 (goto-char (point-max)) ;; #'decode-coding-region just messed up point.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
157 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
158 (query-coding-region (point-min) (point-max) 'windows-1252-unix)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
159 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
160 (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
161 "check query-coding-region fails, windows-1252, invalid-sequences")
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
162 (Assert-equal query-coding-table
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
163 #s(range-table type start-closed-end-open
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
164 data ((130 131) invalid-sequence
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
165 (142 143) invalid-sequence
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
166 (144 146) invalid-sequence
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
167 (158 159) invalid-sequence))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
168 "check query-coding-region fails, windows-1252, invalid-sequences"))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
169 (multiple-value-bind (query-coding-succeeded query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
170 (query-coding-region (point-min) (point-max) 'windows-1252-unix
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
171 (current-buffer) t)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
172 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
173 "checking that query-coding-region succeeds, U+20AC, windows-1252")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
174 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
175 (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
176 "checking that query-coding-region succeeds, U+20AC, windows-1252"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
177 (insert ?\x80)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
178 (multiple-value-bind (query-coding-succeeded query-coding-table)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
179 (query-coding-region (point-min) (point-max) 'windows-1252-unix
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
180 (current-buffer) t)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
181 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
182 (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
183 "checking that query-coding-region fails, U+0080, windows-1252")
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
184 (Assert-equal query-coding-table
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
185 #s(range-table type start-closed-end-open data
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
186 ((257 258) unencodable))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
187 "checking that query-coding-region fails, U+0080, windows-1252"))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
188 (multiple-value-bind (query-coding-succeeded query-coding-table)
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
189 (query-coding-region (point-min) (point-max) 'windows-1252-unix)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
190 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
191 (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
192 "check query-coding-region fails, U+0080, invalid-sequence, cp1252")
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
193 (Assert-equal query-coding-table
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
194 #s(range-table type start-closed-end-open
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
195 data ((130 131) invalid-sequence
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
196 (142 143) invalid-sequence
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
197 (144 146) invalid-sequence
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
198 (158 159) invalid-sequence
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
199 (257 258) unencodable))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
200 "check query-coding-region fails, U+0080, invalid-sequence, cp1252"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
201 ;; Try a similar approach with koi8-o, the koi8 variant with
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
202 ;; support for Old Church Slavonic.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
203 (delete-region (point-min) (point-max))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
204 (insert latin-1-chars-string)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
205 (decode-coding-region (point-min) (point-max) 'koi8-o-unix)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
206 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
207 (query-coding-region (point-min) (point-max) 'koi8-o-unix)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
208 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
209 (eq t query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
210 "checking that query-coding-region succeeds, koi8-o-unix")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
211 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
212 (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
213 "checking that query-coding-region succeeds, koi8-o-unix"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
214 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
215 (query-coding-region (point-min) (point-max) 'escape-quoted)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
216 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
217 "checking that query-coding-region succeeds, escape-quoted")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
218 (Assert (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
219 "checking that query-coding-region succeeds, escape-quoted"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
220 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
221 (query-coding-region (point-min) (point-max) 'windows-1252-unix)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
222 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
223 (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
224 "checking that query-coding-region fails, windows-1252 and Cyrillic")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
225 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
226 (equal query-coding-table
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
227 #s(range-table type start-closed-end-open
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
228 data ((129 131) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
229 (132 133) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
230 (139 140) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
231 (141 146) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
232 (155 156) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
233 (157 161) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
234 (162 170) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
235 (173 176) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
236 (178 187) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
237 (189 192) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
238 (193 257) unencodable)))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
239 "checking that query-coding-region fails, windows-1252 and Cyrillic"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
240 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
241 (query-coding-region (point-min) (point-max) 'koi8-r-unix)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
242 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
243 (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
244 "checking that query-coding-region fails, koi8-r and OCS characters")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
245 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
246 (equal query-coding-table
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
247 #s(range-table type start-closed-end-open
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
248 data ((129 154) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
249 (155 161) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
250 (162 164) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
251 (165 177) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
252 (178 180) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
253 (181 192) unencodable)))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
254 "checking that query-coding-region fails, koi8-r and OCS characters"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
255 ;; Check that the Unicode coding systems handle characters
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
256 ;; without Unicode mappings.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
257 (delete-region (point-min) (point-max))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
258 (insert latin-1-chars-string)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
259 (decode-coding-region (point-min) (point-max) 'greek-iso-8bit-with-esc)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
260 (dolist (coding-system
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
261 '(utf-16-mac ucs-4-mac utf-16-little-endian-bom-dos ucs-4-dos
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
262 utf-16-little-endian-mac utf-16-bom-unix
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
263 utf-16-little-endian ucs-4 utf-16-dos
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
264 ucs-4-little-endian-dos utf-16-bom-mac utf-16-bom
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
265 utf-16-unix utf-32-unix utf-32-little-endian
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
266 utf-32-dos utf-32 utf-32-little-endian-dos utf-8-bom
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
267 utf-16-bom-dos ucs-4-unix
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
268 utf-16-little-endian-bom-unix utf-8-bom-mac
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
269 utf-32-little-endian-unix utf-16
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
270 utf-16-little-endian-dos utf-16-little-endian-bom-mac
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
271 utf-8-bom-dos ucs-4-little-endian-mac utf-8-bom-unix
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
272 utf-32-little-endian-mac utf-8-dos utf-8-unix
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
273 utf-32-mac utf-8-mac utf-16-little-endian-unix
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
274 ucs-4-little-endian ucs-4-little-endian-unix utf-8
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
275 utf-16-little-endian-bom))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
276 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
277 (query-coding-region (point-min) (point-max) coding-system)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
278 (Assert (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
279 "checking unicode coding systems fail with unmapped chars")
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
280 (Assert-equal query-coding-table
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
281 #s(range-table type start-closed-end-open data
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
282 ((173 174) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
283 (209 210) unencodable
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
284 (254 255) unencodable))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
285 "checking unicode coding systems fail with unmapped chars"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
286 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
287 (query-coding-region (point-min) 173 coding-system)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
288 (Assert-eq t query-coding-succeeded
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
289 "checking unicode coding systems succeed sans unmapped chars")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
290 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
291 (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
292 "checking unicode coding systems succeed sans unmapped chars"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
293 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
294 (query-coding-region 174 209 coding-system)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
295 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
296 (eq t query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
297 "checking unicode coding systems succeed sans unmapped chars, again")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
298 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
299 (null query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
300 "checking unicode coding systems succeed sans unmapped chars again"))
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
301 (multiple-value-bind (query-coding-succeeded query-coding-table)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
302 (query-coding-region 210 254 coding-system)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
303 (Assert-eq t query-coding-succeeded)
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
304 (Assert (null query-coding-table)))
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
305 ;; Check that it errors correctly.
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
306 (setq text-conversion-error-signalled nil)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
307 (condition-case nil
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
308 (query-coding-region (point-min) (point-max) coding-system
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
309 (current-buffer) nil t)
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
310 (text-conversion-error
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
311 (setq text-conversion-error-signalled t)))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
312 (Assert text-conversion-error-signalled
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
313 "checking that unicode coding systems error correctly")
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
314 (setq text-conversion-error-signalled nil)
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
315 (condition-case nil
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
316 (query-coding-region (point-min) 173 coding-system
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
317 (current-buffer)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
318 nil t)
4568
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
319 (text-conversion-error
1d74a1d115ee Add #'query-coding-region tests; do the work necessary to get them running.
Aidan Kehoe <kehoea@parhasard.net>
parents:
diff changeset
320 (setq text-conversion-error-signalled t)))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
321 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
322 (null text-conversion-error-signalled)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
323 "checking that unicode coding systems do not error when unnecessary"))
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
324
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
325 (delete-region (point-min) (point-max))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
326 (insert (decode-coding-string "\xff\xff\xff\xff"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
327 'greek-iso-8bit-with-esc))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
328 (insert (decode-coding-string "\xff\xff\xff\xff" 'utf-8))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
329 (insert (decode-coding-string "\xff\xff\xff\xff"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
330 'greek-iso-8bit-with-esc))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
331 (dolist (coding-system '(utf-8 utf-16 utf-16-little-endian
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
332 utf-32 utf-32-little-endian))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
333 (multiple-value-bind (query-coding-succeeded query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
334 (query-coding-region (point-min) (point-max) coding-system)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
335 (Assert (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
336 (format
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
337 "checking %s fails with unmapped chars and invalid seqs"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
338 coding-system))
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
339 (Assert-equal query-coding-table
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
340 #s(range-table type start-closed-end-open
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
341 data ((1 5) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
342 (5 9) invalid-sequence
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
343 (9 13) unencodable))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
344 (format
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
345 "checking %s fails with unmapped chars and invalid seqs"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
346 coding-system)))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
347 (multiple-value-bind (query-coding-succeeded query-coding-table)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
348 (query-coding-region (point-min) (point-max) coding-system
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
349 (current-buffer) t)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
350 (Assert (null query-coding-succeeded)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
351 (format
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
352 "checking %s fails with unmapped chars sans invalid seqs"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
353 coding-system))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
354 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
355 (equal query-coding-table
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
356 #s(range-table type start-closed-end-open
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
357 data ((1 5) unencodable
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
358 (9 13) unencodable)))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
359 (format
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
360 "checking %s fails correctly, unmapped chars sans invalid seqs"
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
361 coding-system))))
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
362 ;; Now to test #'encode-coding-char. Most of the functionality was
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
363 ;; tested in the query-coding-region tests above, so we don't go into
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
364 ;; as much detail here.
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
365 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
366 (null (encode-coding-char
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
367 (decode-char 'ucs #x20ac) 'iso-8859-1))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
368 "check #'encode-coding-char doesn't think iso-8859-1 handles U+20AC")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
369 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
370 (equal "\x80" (encode-coding-char
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
371 (decode-char 'ucs #x20ac) 'windows-1252))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
372 "check #'encode-coding-char doesn't think windows-1252 handles U+0080")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
373 (delete-region (point-min) (point-max))
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
374
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
375 ;; And #'unencodable-char-position.
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
376 (insert latin-1-chars-string)
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
377 (insert (decode-char 'ucs #x20ac))
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
378 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
379 (= 257 (unencodable-char-position (point-min) (point-max)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
380 'iso-8859-1))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
381 "check #'unencodable-char-position doesn't think latin-1 encodes U+20AC")
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
382 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
383 (equal '(257) (unencodable-char-position (point-min) (point-max)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
384 'iso-8859-1 1))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
385 "check #'unencodable-char-position doesn't think latin-1 encodes U+20AC")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
386 ;; Compatiblity, sigh:
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
387 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
388 (equal '(257) (unencodable-char-position (point-min) (point-max)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
389 'iso-8859-1 0))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
390 "check #'unencodable-char-position has some borked GNU semantics")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
391 (dotimes (i 6) (insert (decode-char 'ucs #x20ac)))
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
392 ;; Check if it stops at one:
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
393 (Assert-equal '(257) (unencodable-char-position (point-min) (point-max)
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
394 'iso-8859-1 1)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
395 "check #'unencodable-char-position stops at 1 when asked to")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
396 ;; Check if it stops at four:
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
397 (Assert-equal '(260 259 258 257)
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
398 (unencodable-char-position (point-min) (point-max)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
399 'iso-8859-1 4)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
400 "check #'unencodable-char-position stops at 4 when asked to")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
401 ;; Check whether it stops at seven:
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
402 (Assert-equal '(263 262 261 260 259 258 257)
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
403 (unencodable-char-position (point-min) (point-max)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
404 'iso-8859-1 7)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
405 "check #'unencodable-char-position stops at 7 when asked to")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
406 ;; Check that it still stops at seven:
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
407 (Assert-equal '(263 262 261 260 259 258 257)
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
408 (unencodable-char-position (point-min) (point-max)
4855
189fb67ca31a Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents: 4690
diff changeset
409 'iso-8859-1 2000)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
410 "check #'unencodable-char-position stops at 7 if 2000 asked for")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
411 ;; Now, #'check-coding-systems-region.
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
412 ;; UTF-8 should certainly be able to encode these characters:
4622
8cbca852bcd4 #'check-coding-systems-region: return nil on success, not t.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4604
diff changeset
413 (Assert (null (check-coding-systems-region (point-min) (point-max)
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
414 '(utf-8)))
4622
8cbca852bcd4 #'check-coding-systems-region: return nil on success, not t.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4604
diff changeset
415 "check #'check-coding-systems-region gives nil if encoding works")
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
416 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
417 (equal '((iso-8859-1 257 258 259 260 261 262 263)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
418 (windows-1252 129 130 131 132 133 134 135 136
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
419 137 138 139 140 141 142 143 144
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
420 145 146 147 148 149 150 151 152
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
421 153 154 155 156 157 158 159 160))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
422 (sort
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
423 (check-coding-systems-region (point-min) (point-max)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
424 '(utf-8 iso-8859-1
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
425 windows-1252))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
426 ;; (The sort is to make the algorithm irrelevant.)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
427 #'(lambda (left right)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
428 (string< (car left) (car right)))))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
429 "check #'check-coding-systems-region behaves well given a list")
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
430 ;; Ensure that the indices are all decreased by one when passed a
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
431 ;; string:
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
432 (Assert
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
433 (equal '((iso-8859-1 256 257 258 259 260 261 262)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
434 (windows-1252 128 129 130 131 132 133 134 135
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
435 136 137 138 139 140 141 142 143
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
436 144 145 146 147 148 149 150 151
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
437 152 153 154 155 156 157 158 159))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
438 (sort
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
439 (check-coding-systems-region (buffer-string) nil
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
440 '(utf-8 iso-8859-1
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
441 windows-1252))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
442 #'(lambda (left right)
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
443 (string< (car left) (car right)))))
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
444 "check #'check-coding-systems-region behaves given a string and list"))))
4570
e6a7054a9c30 Add check-coding-systems-region, test it and others, fix some bugs.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4568
diff changeset
445
4604
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
446
e0a8715fdb1f Support new IGNORE-INVALID-SEQUENCESP argument, #'query-coding-region.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4570
diff changeset
447