annotate tests/automated/regexp-tests.el @ 939:025200a2163c

[xemacs-hg @ 2002-07-31 07:23:39 by michaels] 2002-07-17 Marcus Crestani <crestani@informatik.uni-tuebingen.de> Markus Kaltenbach <makalten@informatik.uni-tuebingen.de> Mike Sperber <mike@xemacs.org> configure flag to turn these changes on: --use-kkcc First we added a dumpable flag to lrecord_implementation. It shows, if the object is dumpable and should be processed by the dumper. * lrecord.h (struct lrecord_implementation): added dumpable flag (MAKE_LRECORD_IMPLEMENTATION): fitted the different makro definitions to the new lrecord_implementation and their calls. Then we changed mark_object, that it no longer needs a mark method for those types that have pdump descritions. * alloc.c: (mark_object): If the object has a description, the new mark algorithm is called, and the object is marked according to its description. Otherwise it uses the mark method like before. These procedures mark objects according to their descriptions. They are modeled on the corresponding pdumper procedures. (mark_with_description): (get_indirect_count): (structure_size): (mark_struct_contents): These procedures still call mark_object, this is needed while there are Lisp_Objects without descriptions left. We added pdump descriptions for many Lisp_Objects: * extents.c: extent_auxiliary_description * database.c: database_description * gui.c: gui_item_description * scrollbar.c: scrollbar_instance_description * toolbar.c: toolbar_button_description * event-stream.c: command_builder_description * mule-charset.c: charset_description * device-msw.c: devmode_description * dialog-msw.c: mswindows_dialog_id_description * eldap.c: ldap_description * postgresql.c: pgconn_description pgresult_description * tooltalk.c: tooltalk_message_description tooltalk_pattern_description * ui-gtk.c: emacs_ffi_description emacs_gtk_object_description * events.c: * events.h: * event-stream.c: * event-Xt.c: * event-gtk.c: * event-tty.c: To write a pdump description for Lisp_Event, we converted every struct in the union event to a Lisp_Object. So we created nine new Lisp_Objects: Lisp_Key_Data, Lisp_Button_Data, Lisp_Motion_Data, Lisp_Process_Data, Lisp_Timeout_Data, Lisp_Eval_Data, Lisp_Misc_User_Data, Lisp_Magic_Data, Lisp_Magic_Eval_Data. We also wrote makro selectors and mutators for the fields of the new designed Lisp_Event and added everywhere these new abstractions. We implemented XD_UNION support in (mark_with_description), so we can describe exspecially console/device specific data with XD_UNION. To describe with XD_UNION, we added a field to these objects, which holds the variant type of the object. This field is initialized in the appendant constructor. The variant is an integer, it has also to be described in an description, if XD_UNION is used. XD_UNION is used in following descriptions: * console.c: console_description (get_console_variant): returns the variant (create_console): added variant initialization * console.h (console_variant): the different console types * console-impl.h (struct console): added enum console_variant contype * device.c: device_description (Fmake_device): added variant initialization * device-impl.h (struct device): added enum console_variant devtype * objects.c: image_instance_description font_instance_description (Fmake_color_instance): added variant initialization (Fmake_font_instance): added variant initialization * objects-impl.h (struct Lisp_Color_Instance): added color_instance_type * objects-impl.h (struct Lisp_Font_Instance): added font_instance_type * process.c: process_description (make_process_internal): added variant initialization * process.h (process_variant): the different process types
author michaels
date Wed, 31 Jul 2002 07:23:39 +0000
parents 3078fd1074e8
children ccaf90c5a53a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
1 ;;; -*- coding: iso-8859-1 -*-
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
2
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
3 ;; Copyright (C) 2000 Free Software Foundation, Inc.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
4
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
5 ;; Author: Yoshiki Hayashi <yoshiki@xemacs.org>
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
6 ;; Maintainer: Yoshiki Hayashi <yoshiki@xemacs.org>
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
7 ;; Created: 2000
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
8 ;; Keywords: tests
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
9
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
11
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
15 ;; any later version.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
16
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
20 ;; General Public License for more details.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
21
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
25 ;; 02111-1307, USA.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
26
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
28
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
29 ;;; Commentary:
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
30
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
31 ;; Test regular expression.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
32
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
33 (Check-Error-Message error "Trailing backslash"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
34 (string-match "\\" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
35 (Check-Error-Message error "Invalid preceding regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
36 (string-match "a++" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
37 (Check-Error-Message error "Invalid preceding regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
38 (string-match "a**" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
39 (Check-Error-Message error "Invalid preceding regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
40 (string-match "a???" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
41 (Check-Error-Message error "Unmatched \\[ or \\[^"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
42 (string-match "[" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
43 (Check-Error-Message error "Unmatched \\[ or \\[^"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
44 (string-match "[abc" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
45 (Check-Error-Message error "Unmatched ) or \\\\)"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
46 (string-match "\\)" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
47 (Check-Error-Message error "Invalid regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
48 (string-match "\\(?.\\)" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
49 (Check-Error-Message error "Unmatched \\\\{"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
50 (string-match "a\\{" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
51 (Check-Error-Message error "Invalid content of \\\\{\\\\}"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
52 (string-match "a\\{a\\}" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
53
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
54 ;; exactn
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
55
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
56 ;; string-match
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
57 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
58 ;; case-insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
59 (Assert (string-match "ä" "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
60 (Assert (string-match "ä" "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
61 (Assert (string-match "Ä" "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
62 (Assert (string-match "Ä" "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
63 ;; case-sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
64 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
65 (Assert (string-match "ä" "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
66 (Assert (not (string-match "ä" "Ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
67 (Assert (string-match "Ä" "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
68 (Assert (not (string-match "Ä" "ä"))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
69
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
70 ;; looking-at
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
71 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
72 (insert "äÄ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
73 ;; case-insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
74 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
75 (Assert (looking-at "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
76 (Assert (looking-at "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
77 (forward-char)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
78 (Assert (looking-at "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
79 (Assert (looking-at "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
80 ;; case-sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
81 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
82 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
83 (Assert (looking-at "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
84 (Assert (not (looking-at "Ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
85 (forward-char)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
86 (Assert (not (looking-at "ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
87 (Assert (looking-at "Ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
88
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
89 ;; re-search-forward and re-search-backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
90 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
91 (insert "äÄ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
92 ;; case insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
93 ;; forward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
94 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
95 ;; Avoid trivial regexp.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
96 (Assert (eq 2 (re-search-forward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
97 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
98 (Assert (eq 2 (re-search-forward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
99 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
100 (Assert (eq 3 (re-search-forward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
101 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
102 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
103 ;; backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
104 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
105 (Assert (eq 2 (re-search-backward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
106 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
107 (Assert (eq 2 (re-search-backward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
108 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
109 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
110 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
111 (Assert (eq 1 (re-search-backward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
112 ;; case sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
113 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
114 ;; forward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
115 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
116 (Assert (eq 2 (re-search-forward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
117 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
118 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
119 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
120 (Assert (not (re-search-forward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
121 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
122 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
123 ;; backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
124 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
125 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
126 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
127 (Assert (eq 2 (re-search-backward "Ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
128 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
129 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
130 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
131 (Assert (not (re-search-backward "Ä\\|a" nil t))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
132
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
133 ;; duplicate
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
134 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
135 ;; case insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
136 (Assert (string-match "^\\(ä\\)\\1$" "ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
137 (Assert (string-match "^\\(ä\\)\\1$" "äÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
138 (Assert (string-match "^\\(ä\\)\\1$" "ÄÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
139 (Assert (string-match "^\\(ä\\)\\1$" "Ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
140 (Assert (string-match "^\\(Ä\\)\\1$" "ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
141 (Assert (string-match "^\\(Ä\\)\\1$" "äÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
142 (Assert (string-match "^\\(Ä\\)\\1$" "ÄÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
143 (Assert (string-match "^\\(Ä\\)\\1$" "Ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
144 ;; case sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
145 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
146 (Assert (string-match "^\\(ä\\)\\1$" "ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
147 (Assert (not (string-match "^\\(ä\\)\\1$" "äÄ")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
148 (Assert (not (string-match "^\\(ä\\)\\1$" "ÄÄ")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
149 (Assert (not (string-match "^\\(ä\\)\\1$" "Ää")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
150 (Assert (not (string-match "^\\(Ä\\)\\1$" "ää")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
151 (Assert (not (string-match "^\\(Ä\\)\\1$" "äÄ")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
152 (Assert (string-match "^\\(Ä\\)\\1$" "ÄÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
153 (Assert (not (string-match "^\\(Ä\\)\\1$" "Ää"))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
154
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
155 ;; charset, charset_not
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
156 ;; Not called because it takes too much time.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
157 (defun test-regexp-charset-paranoid ()
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
158 (let ((i 0)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
159 (max (expt 2 (if (featurep 'mule) 19 8)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
160 (range "[a-z]")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
161 (range-not "[^a-z]")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
162 char string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
163 (while (< i max)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
164 (when (setq char (int-to-char i))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
165 (setq string (char-to-string char))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
166 (if (or (and (<= 65 i)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
167 (<= i 90))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
168 (and (<= 97 i)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
169 (<= i 122)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
170 (progn
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
171 (Assert (string-match range string))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
172 (Assert (not (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
173 (Assert (not (string-match range string)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
174 (Assert (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
175 (setq i (1+ i)))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
176
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
177 ;; (test-regexp-charset-paranoid)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
178
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
179 ;; charset_mule, charset_mule_not
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
180 ;; Not called because it takes too much time.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
181 (defun test-regex-charset-mule-paranoid ()
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
182 (if (featurep 'mule)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
183 (let ((i 0)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
184 (max (expt 2 19))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
185 (range (format "[%c-%c]"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
186 (make-char 'japanese-jisx0208 36 34)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
187 (make-char 'japanese-jisx0208 36 42)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
188 (range-not (format "[^%c-%c]"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
189 (make-char 'japanese-jisx0208 36 34)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
190 (make-char 'japanese-jisx0208 36 42)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
191 (min-int (char-to-int (make-char 'japanese-jisx0208 36 34)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
192 (max-int (char-to-int (make-char 'japanese-jisx0208 36 42)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
193 char string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
194 (while (< i max)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
195 (when (setq char (int-to-char i))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
196 (setq string (char-to-string char))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
197 (if (and (<= min-int i)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
198 (<= i max-int))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
199 (progn
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
200 (Assert (string-match range string))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
201 (Assert (not (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
202 (Assert (not (string-match range string)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
203 (Assert (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
204 (setq i (1+ i))))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
205
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
206 ;; (test-regex-charset-mule-paranoid)
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
207
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
208 ;; Test replace-match
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
209 (with-temp-buffer
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
210 (insert "This is a test buffer.")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
211 (goto-char (point-min))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
212 (search-forward "this is a test ")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
213 (looking-at "Unmatchable text")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
214 (replace-match "")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
215 (Assert (looking-at "^buffer.$")))