comparison tests/automated/regexp-tests.el @ 5136:0f66906b6e37

Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically -------------------- ChangeLog entries follow: -------------------- lisp/ChangeLog addition: 2010-03-12 Ben Wing <ben@xemacs.org> * test-harness.el (test-harness-from-buffer): Undo change of e.g. (Assert (equalp ...)) to (Assert-equalp ...). Get rid of `Assert-equalp' and friends, `Assert-test', and `Assert-test-not'. Instead, make `Assert' smart enough to do the equivalent functionality when an expression like (Assert (equalp ...)) is seen. tests/ChangeLog addition: 2010-03-12 Ben Wing <ben@xemacs.org> * automated/base64-tests.el (bt-base64-encode-string): * automated/base64-tests.el (bt-base64-decode-string): * automated/base64-tests.el (for): * automated/byte-compiler-tests.el: * automated/byte-compiler-tests.el (before-and-after-compile-equal): * automated/case-tests.el (downcase-string): * automated/case-tests.el (uni-mappings): * automated/ccl-tests.el (ccl-test-normal-expr): * automated/ccl-tests.el (ccl-test-map-instructions): * automated/ccl-tests.el (ccl-test-suites): * automated/database-tests.el (delete-database-files): * automated/extent-tests.el (let): * automated/extent-tests.el (insert): * automated/extent-tests.el (props): * automated/file-tests.el: * automated/file-tests.el (for): * automated/hash-table-tests.el (test): * automated/hash-table-tests.el (for): * automated/hash-table-tests.el (ht): * automated/hash-table-tests.el (iterations): * automated/hash-table-tests.el (h1): * automated/hash-table-tests.el (equal): * automated/hash-table-tests.el (=): * automated/lisp-tests.el: * automated/lisp-tests.el (eq): * automated/lisp-tests.el (test-setq): * automated/lisp-tests.el (my-vector): * automated/lisp-tests.el (x): * automated/lisp-tests.el (equal): * automated/lisp-tests.el (y): * automated/lisp-tests.el (featurep): * automated/lisp-tests.el (=): * automated/lisp-tests.el (six): * automated/lisp-tests.el (three): * automated/lisp-tests.el (one): * automated/lisp-tests.el (two): * automated/lisp-tests.el (five): * automated/lisp-tests.el (test1): * automated/lisp-tests.el (division-test): * automated/lisp-tests.el (for): * automated/lisp-tests.el (check-function-argcounts): * automated/lisp-tests.el (z): * automated/lisp-tests.el (eql): * automated/lisp-tests.el (test-harness-risk-infloops): * automated/lisp-tests.el (erase-buffer): * automated/lisp-tests.el (sym): * automated/lisp-tests.el (new-char): * automated/lisp-tests.el (new-load-file-name): * automated/lisp-tests.el (cl-floor): * automated/lisp-tests.el (foo): * automated/md5-tests.el (lambda): * automated/md5-tests.el (large-string): * automated/md5-tests.el (mapcar): * automated/md5-tests.el (insert): * automated/mule-tests.el: * automated/mule-tests.el (test-chars): * automated/mule-tests.el (existing-file-name): * automated/mule-tests.el (featurep): * automated/query-coding-tests.el (featurep): * automated/regexp-tests.el: * automated/regexp-tests.el (insert): * automated/regexp-tests.el (Assert): * automated/regexp-tests.el (=): * automated/regexp-tests.el (featurep): * automated/regexp-tests.el (text): * automated/regexp-tests.el (text1): * automated/regexp-tests.el ("aáa"): * automated/regexp-tests.el (eql): * automated/search-tests.el (insert): * automated/search-tests.el (featurep): * automated/search-tests.el (let): * automated/search-tests.el (boundp): * automated/symbol-tests.el: * automated/symbol-tests.el (name): * automated/symbol-tests.el (check-weak-list-unique): * automated/symbol-tests.el (string): * automated/symbol-tests.el (list): * automated/symbol-tests.el (foo): * automated/symbol-tests.el (eq): * automated/symbol-tests.el (fresh-keyword-name): * automated/symbol-tests.el (print-gensym): * automated/symbol-tests.el (mysym): * automated/syntax-tests.el (test-forward-word): * automated/syntax-tests.el (test-backward-word): * automated/syntax-tests.el (test-syntax-table): * automated/syntax-tests.el (with-syntax-table): * automated/syntax-tests.el (Skip-Test-Unless): * automated/syntax-tests.el (with): * automated/tag-tests.el (testfile): * automated/weak-tests.el (w): * automated/weak-tests.el (p): * automated/weak-tests.el (a): Undo change of e.g. (Assert (equalp ...)) to (Assert-equalp ...). Get rid of `Assert-equalp' and friends, `Assert-test', and `Assert-test-not'. Instead, make `Assert' smart enough to do the equivalent functionality when an expression like (Assert (equalp ...)) is seen.
author Ben Wing <ben@xemacs.org>
date Fri, 12 Mar 2010 18:27:51 -0600
parents 6ef8256a020a
children 308d34e9f07d
comparison
equal deleted inserted replaced
5113:b2dcf6a6d8ab 5136:0f66906b6e37
1 ;;; -*- coding: iso-8859-1 -*- 1 ;;; -*- coding: iso-8859-1 -*-
2 2
3 ;; Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. 3 ;; Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
4 ;; Copyright (C) 2010 Ben Wing.
4 5
5 ;; Author: Yoshiki Hayashi <yoshiki@xemacs.org> 6 ;; Author: Yoshiki Hayashi <yoshiki@xemacs.org>
6 ;; Maintainer: Stephen J. Turnbull <stephen@xemacs.org> 7 ;; Maintainer: Stephen J. Turnbull <stephen@xemacs.org>
7 ;; Created: 2000 8 ;; Created: 2000
8 ;; Keywords: tests 9 ;; Keywords: tests
94 (insert "äÄ") 95 (insert "äÄ")
95 ;; case insensitive 96 ;; case insensitive
96 ;; forward 97 ;; forward
97 (goto-char (point-min)) 98 (goto-char (point-min))
98 ;; Avoid trivial regexp. 99 ;; Avoid trivial regexp.
99 (Assert-eq 2 (re-search-forward "ä\\|a" nil t)) 100 (Assert (eq 2 (re-search-forward "ä\\|a" nil t)))
100 (goto-char (point-min)) 101 (goto-char (point-min))
101 (Assert-eq 2 (re-search-forward "Ä\\|a" nil t)) 102 (Assert (eq 2 (re-search-forward "Ä\\|a" nil t)))
102 (goto-char (1+ (point-min))) 103 (goto-char (1+ (point-min)))
103 (Assert-eq 3 (re-search-forward "ä\\|a" nil t)) 104 (Assert (eq 3 (re-search-forward "ä\\|a" nil t)))
104 (goto-char (1+ (point-min))) 105 (goto-char (1+ (point-min)))
105 (Assert-eq 3 (re-search-forward "Ä\\|a" nil t)) 106 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
106 ;; backward 107 ;; backward
107 (goto-char (point-max)) 108 (goto-char (point-max))
108 (Assert-eq 2 (re-search-backward "ä\\|a" nil t)) 109 (Assert (eq 2 (re-search-backward "ä\\|a" nil t)))
109 (goto-char (point-max)) 110 (goto-char (point-max))
110 (Assert-eq 2 (re-search-backward "Ä\\|a" nil t)) 111 (Assert (eq 2 (re-search-backward "Ä\\|a" nil t)))
111 (goto-char (1- (point-max))) 112 (goto-char (1- (point-max)))
112 (Assert-eq 1 (re-search-backward "ä\\|a" nil t)) 113 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
113 (goto-char (1- (point-max))) 114 (goto-char (1- (point-max)))
114 (Assert-eq 1 (re-search-backward "Ä\\|a" nil t)) 115 (Assert (eq 1 (re-search-backward "Ä\\|a" nil t)))
115 ;; case sensitive 116 ;; case sensitive
116 (setq case-fold-search nil) 117 (setq case-fold-search nil)
117 ;; forward 118 ;; forward
118 (goto-char (point-min)) 119 (goto-char (point-min))
119 (Assert-eq 2 (re-search-forward "ä\\|a" nil t)) 120 (Assert (eq 2 (re-search-forward "ä\\|a" nil t)))
120 (goto-char (point-min)) 121 (goto-char (point-min))
121 (Assert-eq 3 (re-search-forward "Ä\\|a" nil t)) 122 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
122 (goto-char (1+ (point-min))) 123 (goto-char (1+ (point-min)))
123 (Assert (not (re-search-forward "ä\\|a" nil t))) 124 (Assert (not (re-search-forward "ä\\|a" nil t)))
124 (goto-char (1+ (point-min))) 125 (goto-char (1+ (point-min)))
125 (Assert-eq 3 (re-search-forward "Ä\\|a" nil t)) 126 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
126 ;; backward 127 ;; backward
127 (goto-char (point-max)) 128 (goto-char (point-max))
128 (Assert-eq 1 (re-search-backward "ä\\|a" nil t)) 129 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
129 (goto-char (point-max)) 130 (goto-char (point-max))
130 (Assert-eq 2 (re-search-backward "Ä\\|a" nil t)) 131 (Assert (eq 2 (re-search-backward "Ä\\|a" nil t)))
131 (goto-char (1- (point-max))) 132 (goto-char (1- (point-max)))
132 (Assert-eq 1 (re-search-backward "ä\\|a" nil t)) 133 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
133 (goto-char (1- (point-max))) 134 (goto-char (1- (point-max)))
134 (Assert (not (re-search-backward "Ä\\|a" nil t)))) 135 (Assert (not (re-search-backward "Ä\\|a" nil t))))
135 136
136 ;; duplicate 137 ;; duplicate
137 (with-temp-buffer 138 (with-temp-buffer
215 (forward-line 1) 216 (forward-line 1)
216 (Assert (looking-at "^[a]\\{3,5\\}$")) 217 (Assert (looking-at "^[a]\\{3,5\\}$"))
217 (forward-line 1) 218 (forward-line 1)
218 (Assert (not (looking-at "^[a]\\{3,5\\}$"))) 219 (Assert (not (looking-at "^[a]\\{3,5\\}$")))
219 (goto-char (point-min)) 220 (goto-char (point-min))
220 (Assert= 12 (re-search-forward "a\\{4,4\\}")) 221 (Assert (= 12 (re-search-forward "a\\{4,4\\}")))
221 (goto-char (point-min)) 222 (goto-char (point-min))
222 (Assert= 12 (re-search-forward "b?a\\{4,4\\}")) 223 (Assert (= 12 (re-search-forward "b?a\\{4,4\\}")))
223 (goto-char (point-min)) 224 (goto-char (point-min))
224 (Assert= 31 (re-search-forward "ba\\{4,4\\}")) 225 (Assert (= 31 (re-search-forward "ba\\{4,4\\}")))
225 (goto-char (point-min)) 226 (goto-char (point-min))
226 (Assert= 31 (re-search-forward "[b]a\\{4,4\\}")) 227 (Assert (= 31 (re-search-forward "[b]a\\{4,4\\}")))
227 (goto-char (point-min)) 228 (goto-char (point-min))
228 (Assert= 31 (re-search-forward "\\(b\\)a\\{4,4\\}")) 229 (Assert (= 31 (re-search-forward "\\(b\\)a\\{4,4\\}")))
229 (goto-char (point-min)) 230 (goto-char (point-min))
230 (Assert= 12 (re-search-forward "^a\\{4,4\\}")) 231 (Assert (= 12 (re-search-forward "^a\\{4,4\\}")))
231 (goto-char (point-min)) 232 (goto-char (point-min))
232 (Assert= 12 (re-search-forward "^a\\{4,4\\}$")) 233 (Assert (= 12 (re-search-forward "^a\\{4,4\\}$")))
233 (goto-char (point-min)) 234 (goto-char (point-min))
234 (Assert= 12 (re-search-forward "[a]\\{4,4\\}")) 235 (Assert (= 12 (re-search-forward "[a]\\{4,4\\}")))
235 (goto-char (point-min)) 236 (goto-char (point-min))
236 (Assert= 12 (re-search-forward "^[a]\\{4,4\\}")) 237 (Assert (= 12 (re-search-forward "^[a]\\{4,4\\}")))
237 (goto-char (point-min)) 238 (goto-char (point-min))
238 (Assert= 12 (re-search-forward "^[a]\\{4,4\\}$")) 239 (Assert (= 12 (re-search-forward "^[a]\\{4,4\\}$")))
239 ) 240 )
240 241
241 ;; charset, charset_not 242 ;; charset, charset_not
242 ;; Not called because it takes too much time. 243 ;; Not called because it takes too much time.
243 (defun test-regexp-charset-paranoid () 244 (defun test-regexp-charset-paranoid ()
313 (re-search-forward "b") 314 (re-search-forward "b")
314 (Assert (string= (match-string 0) "b")) 315 (Assert (string= (match-string 0) "b"))
315 (Assert (string= (match-string 1) nil))) 316 (Assert (string= (match-string 1) nil)))
316 317
317 ;; Test word boundaries 318 ;; Test word boundaries
318 (Assert= (string-match "\\<a" " a") 1) 319 (Assert (= (string-match "\\<a" " a") 1))
319 (Assert= (string-match "a\\>" "a ") 0) 320 (Assert (= (string-match "a\\>" "a ") 0))
320 (Assert= (string-match "\\ba" " a") 1) 321 (Assert (= (string-match "\\ba" " a") 1))
321 (Assert= (string-match "a\\b" "a ") 0) 322 (Assert (= (string-match "a\\b" "a ") 0))
322 ;; should work at target boundaries 323 ;; should work at target boundaries
323 (Assert= (string-match "\\<a" "a") 0) 324 (Assert (= (string-match "\\<a" "a") 0))
324 (Assert= (string-match "a\\>" "a") 0) 325 (Assert (= (string-match "a\\>" "a") 0))
325 (Assert= (string-match "\\ba" "a") 0) 326 (Assert (= (string-match "\\ba" "a") 0))
326 (Assert= (string-match "a\\b" "a") 0) 327 (Assert (= (string-match "a\\b" "a") 0))
327 ;; Check for weirdness 328 ;; Check for weirdness
328 (Assert (not (string-match " \\> " " "))) 329 (Assert (not (string-match " \\> " " ")))
329 (Assert (not (string-match " \\< " " "))) 330 (Assert (not (string-match " \\< " " ")))
330 (Assert (not (string-match " \\b " " "))) 331 (Assert (not (string-match " \\b " " ")))
331 ;; but not if the "word" would be on the null side of the boundary! 332 ;; but not if the "word" would be on the null side of the boundary!
349 ;; note: (int-to-char 65) => ?A 350 ;; note: (int-to-char 65) => ?A
350 (let ((ch0 (make-char 'japanese-jisx0208 52 65)) 351 (let ((ch0 (make-char 'japanese-jisx0208 52 65))
351 (ch1 (make-char 'japanese-jisx0208 51 65))) 352 (ch1 (make-char 'japanese-jisx0208 51 65)))
352 (Assert (not (string-match "A" (string ch0)))) 353 (Assert (not (string-match "A" (string ch0))))
353 (Assert (not (string-match "[A]" (string ch0)))) 354 (Assert (not (string-match "[A]" (string ch0))))
354 (Assert-eq (string-match "[^A]" (string ch0)) 0) 355 (Assert (eq (string-match "[^A]" (string ch0)) 0))
355 (Assert (not (string-match "@A" (string ?@ ch0)))) 356 (Assert (not (string-match "@A" (string ?@ ch0))))
356 (Assert (not (string-match "@[A]" (string ?@ ch0)))) 357 (Assert (not (string-match "@[A]" (string ?@ ch0))))
357 (Assert-eq (string-match "@[^A]" (string ?@ ch0)) 0) 358 (Assert (eq (string-match "@[^A]" (string ?@ ch0)) 0))
358 (Assert (not (string-match "@?A" (string ?@ ch0)))) 359 (Assert (not (string-match "@?A" (string ?@ ch0))))
359 (Assert (not (string-match "A" (string ch1)))) 360 (Assert (not (string-match "A" (string ch1))))
360 (Assert (not (string-match "[A]" (string ch1)))) 361 (Assert (not (string-match "[A]" (string ch1))))
361 (Assert-eq (string-match "[^A]" (string ch1)) 0) 362 (Assert (eq (string-match "[^A]" (string ch1)) 0))
362 (Assert (not (string-match "@A" (string ?@ ch1)))) 363 (Assert (not (string-match "@A" (string ?@ ch1))))
363 (Assert (not (string-match "@[A]" (string ?@ ch1)))) 364 (Assert (not (string-match "@[A]" (string ?@ ch1))))
364 (Assert-eq (string-match "@[^A]" (string ?@ ch1)) 0) 365 (Assert (eq (string-match "@[^A]" (string ?@ ch1)) 0))
365 (Assert (not (string-match "@?A" (string ?@ ch1)))) 366 (Assert (not (string-match "@?A" (string ?@ ch1))))
366 ) 367 )
367 ) 368 )
368 369
369 ;; More stale match data tests. 370 ;; More stale match data tests.
406 407
407 ;; bug identified by Katsumi Yamaoka 2004-09-03 <b9ywtzbbpue.fsf_-_@jpl.org> 408 ;; bug identified by Katsumi Yamaoka 2004-09-03 <b9ywtzbbpue.fsf_-_@jpl.org>
408 ;; fix submitted by sjt 2004-09-08 409 ;; fix submitted by sjt 2004-09-08
409 ;; trailing comments are values from buggy 21.4.15 410 ;; trailing comments are values from buggy 21.4.15
410 (let ((text "abc")) 411 (let ((text "abc"))
411 (Assert-eq 0 (string-match "\\(?:ab+\\)*c" text)) ; 2 412 (Assert (eq 0 (string-match "\\(?:ab+\\)*c" text))) ; 2
412 (Assert-eq 0 (string-match "^\\(?:ab+\\)*c" text)) ; nil 413 (Assert (eq 0 (string-match "^\\(?:ab+\\)*c" text))) ; nil
413 (Assert-eq 0 (string-match "^\\(?:ab+\\)*" text)) ; 0 414 (Assert (eq 0 (string-match "^\\(?:ab+\\)*" text))) ; 0
414 (Assert-eq 0 (string-match "^\\(?:ab+\\)c" text)) ; 0 415 (Assert (eq 0 (string-match "^\\(?:ab+\\)c" text))) ; 0
415 (Assert-eq 0 (string-match "^\\(?:ab\\)*c" text)) ; 0 416 (Assert (eq 0 (string-match "^\\(?:ab\\)*c" text))) ; 0
416 (Assert-eq 0 (string-match "^\\(?:a+\\)*b" text)) ; nil 417 (Assert (eq 0 (string-match "^\\(?:a+\\)*b" text))) ; nil
417 (Assert-eq 0 (string-match "^\\(?:a\\)*b" text)) ; 0 418 (Assert (eq 0 (string-match "^\\(?:a\\)*b" text))) ; 0
418 ) 419 )
419 420
420 ;; per Steve Youngs 2004-09-30 <microsoft-free.87ekkjhj7t.fsf@youngs.au.com> 421 ;; per Steve Youngs 2004-09-30 <microsoft-free.87ekkjhj7t.fsf@youngs.au.com>
421 ;; fix submitted by sjt 2004-10-07 422 ;; fix submitted by sjt 2004-10-07
422 ;; trailing comments are values from buggy 21.4.pre16 423 ;; trailing comments are values from buggy 21.4.pre16
423 (let ((text "abc")) 424 (let ((text "abc"))
424 (Assert-eq 0 (string-match "\\(?:a\\(b\\)\\)" text)) ; 0 425 (Assert (eq 0 (string-match "\\(?:a\\(b\\)\\)" text))) ; 0
425 (Assert (string= (match-string 1 text) "b")) ; ab 426 (Assert (string= (match-string 1 text) "b")) ; ab
426 (Assert (null (match-string 2 text))) ; b 427 (Assert (null (match-string 2 text))) ; b
427 (Assert (null (match-string 3 text))) ; nil 428 (Assert (null (match-string 3 text))) ; nil
428 (Assert-eq 0 (string-match "\\(?:a\\(?:b\\(c\\)\\)\\)" text)) ; 0 429 (Assert (eq 0 (string-match "\\(?:a\\(?:b\\(c\\)\\)\\)" text))) ; 0
429 (Assert (string= (match-string 1 text) "c")) ; abc 430 (Assert (string= (match-string 1 text) "c")) ; abc
430 (Assert (null (match-string 2 text))) ; ab 431 (Assert (null (match-string 2 text))) ; ab
431 (Assert (null (match-string 3 text))) ; c 432 (Assert (null (match-string 3 text))) ; c
432 (Assert (null (match-string 4 text))) ; nil 433 (Assert (null (match-string 4 text))) ; nil
433 ) 434 )
438 (re0 "\\(a\\)\\(b\\)\\2") 439 (re0 "\\(a\\)\\(b\\)\\2")
439 (re1 "\\(?:a\\)\\(b\\)\\2") 440 (re1 "\\(?:a\\)\\(b\\)\\2")
440 (re2 "\\(?:a\\)\\(b\\)\\1") 441 (re2 "\\(?:a\\)\\(b\\)\\1")
441 (re3 "\\(a\\)\\(?:b\\)\\1")) 442 (re3 "\\(a\\)\\(?:b\\)\\1"))
442 443
443 (Assert-eq 0 (string-match re0 text1)) 444 (Assert (eq 0 (string-match re0 text1)))
444 (Assert (string= text1 (match-string 0 text1))) 445 (Assert (string= text1 (match-string 0 text1)))
445 (Assert (string= "a" (match-string 1 text1))) 446 (Assert (string= "a" (match-string 1 text1)))
446 (Assert (string= "b" (match-string 2 text1))) 447 (Assert (string= "b" (match-string 2 text1)))
447 (Assert (null (string-match re0 text2))) 448 (Assert (null (string-match re0 text2)))
448 449
449 (Check-Error-Message 'invalid-regexp "Invalid back reference" 450 (Check-Error-Message 'invalid-regexp "Invalid back reference"
450 (string-match re1 text1)) 451 (string-match re1 text1))
451 452
452 (Assert-eq 0 (string-match re2 text1)) 453 (Assert (eq 0 (string-match re2 text1)))
453 (Assert (string= text1 (match-string 0 text1))) 454 (Assert (string= text1 (match-string 0 text1)))
454 (Assert (string= "b" (match-string 1 text1))) 455 (Assert (string= "b" (match-string 1 text1)))
455 (Assert (null (match-string 2 text1))) 456 (Assert (null (match-string 2 text1)))
456 (Assert (null (string-match re2 text2))) 457 (Assert (null (string-match re2 text2)))
457 458
458 (Assert (null (string-match re3 text1))) 459 (Assert (null (string-match re3 text1)))
459 (Assert-eq 0 (string-match re3 text2)) 460 (Assert (eq 0 (string-match re3 text2)))
460 (Assert (string= text2 (match-string 0 text2))) 461 (Assert (string= text2 (match-string 0 text2)))
461 (Assert (string= "a" (match-string 1 text2))) 462 (Assert (string= "a" (match-string 1 text2)))
462 (Assert (null (match-string 2 text2))) 463 (Assert (null (match-string 2 text2)))
463 ) 464 )
464 465
529 530
530 (with-string-as-buffer-contents 531 (with-string-as-buffer-contents
531 "-]-----------------------------][]]------------------------" 532 "-]-----------------------------][]]------------------------"
532 (goto-char (point-min)) 533 (goto-char (point-min))
533 (skip-chars-forward (skip-chars-quote "-[]")) 534 (skip-chars-forward (skip-chars-quote "-[]"))
534 (Assert= (point) (point-max)) 535 (Assert (= (point) (point-max)))
535 (skip-chars-backward (skip-chars-quote "-[]")) 536 (skip-chars-backward (skip-chars-quote "-[]"))
536 (Assert= (point) (point-min)) 537 (Assert (= (point) (point-min)))
537 ;; Testing in passing for an old bug in #'skip-chars-forward where I 538 ;; Testing in passing for an old bug in #'skip-chars-forward where I
538 ;; thought it was impossible to call it with a string containing only ?- 539 ;; thought it was impossible to call it with a string containing only ?-
539 ;; and ?]: 540 ;; and ?]:
540 (Assert= (skip-chars-forward (skip-chars-quote "-]")) 541 (Assert (= (skip-chars-forward (skip-chars-quote "-]"))
541 (position ?[ (buffer-string) :test #'=)) 542 (position ?[ (buffer-string) :test #'=)))
542 ;; This used to error, incorrectly: 543 ;; This used to error, incorrectly:
543 (Assert (skip-chars-quote "[-"))) 544 (Assert (skip-chars-quote "[-")))
544 545
545 ;; replace-match (REPLACEMENT &optional FIXEDCASE LITERAL STRING STRBUFFER) 546 ;; replace-match (REPLACEMENT &optional FIXEDCASE LITERAL STRING STRBUFFER)
546 547
552 ;; Thanks Julian Bradford on XEmacs Beta 553 ;; Thanks Julian Bradford on XEmacs Beta
553 ;; <18652.54975.894512.880956@krk.inf.ed.ac.uk> 554 ;; <18652.54975.894512.880956@krk.inf.ed.ac.uk>
554 (with-string-as-buffer-contents "aáa" 555 (with-string-as-buffer-contents "aáa"
555 (goto-char (point-min)) 556 (goto-char (point-min))
556 (Assert (looking-at "\\=")) 557 (Assert (looking-at "\\="))
557 (Assert= (re-search-forward "\\=") 1) 558 (Assert (= (re-search-forward "\\=") 1))
558 (forward-char 1) 559 (forward-char 1)
559 (Assert (looking-at "\\=")) 560 (Assert (looking-at "\\="))
560 (Assert= (re-search-forward "\\=") 2) 561 (Assert (= (re-search-forward "\\=") 2))
561 (forward-char 1) 562 (forward-char 1)
562 (Assert (looking-at "\\=")) 563 (Assert (looking-at "\\="))
563 (Assert= (re-search-forward "\\=") 3) 564 (Assert (= (re-search-forward "\\=") 3))
564 (forward-char 1) 565 (forward-char 1)
565 (Assert (looking-at "\\=")) 566 (Assert (looking-at "\\="))
566 (Assert= (re-search-forward "\\=") 4)) 567 (Assert (= (re-search-forward "\\=") 4)))
567 568
568 569
569 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 570 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
570 ;; Tests involving case-changing replace-match ;; 571 ;; Tests involving case-changing replace-match ;;
571 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 572 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
582 (Assert (and (bobp) (eobp)))) 583 (Assert (and (bobp) (eobp))))
583 584
584 ;; Control-1 characters were second-class citizens in regexp ranges 585 ;; Control-1 characters were second-class citizens in regexp ranges
585 ;; for a while there. Addressed in Ben's Mercurial changeset 586 ;; for a while there. Addressed in Ben's Mercurial changeset
586 ;; 2e15c29cc2b3; attempt to ensure this doesn't happen again. 587 ;; 2e15c29cc2b3; attempt to ensure this doesn't happen again.
587 (Assert-eql (string-match "[\x00-\x7f\x80-\x9f]" "a") 0) 588 (Assert (eql (string-match "[\x00-\x7f\x80-\x9f]" "a") 0))
588 (Assert-eql (string-match "[\x00-\x7f\x80-\x9f]" "é") nil) 589 (Assert (eql (string-match "[\x00-\x7f\x80-\x9f]" "é") nil))
589 ;; Gave nil in 21.5 for a couple of years. 590 ;; Gave nil in 21.5 for a couple of years.
590 (Assert-eql (string-match "[\x00-\x7f\x80-\x9f]" "\x80") 0) 591 (Assert (eql (string-match "[\x00-\x7f\x80-\x9f]" "\x80") 0))
591 (Assert-eql (string-match "[\x00-\x7f]\\|[\x80-\x9f]" "\x80") 0) 592 (Assert (eql (string-match "[\x00-\x7f]\\|[\x80-\x9f]" "\x80") 0))
592 ;; Gave nil 593 ;; Gave nil
593 (Assert-eql (string-match "[\x7f\x80-\x9f]" "\x80") 0) 594 (Assert (eql (string-match "[\x7f\x80-\x9f]" "\x80") 0))
594 (Assert-eql (string-match "[\x80-\x9f]" "\x80") 0) 595 (Assert (eql (string-match "[\x80-\x9f]" "\x80") 0))
595 (Assert-eql (string-match "[\x7f\x80-\x9e]" "\x80") 0) 596 (Assert (eql (string-match "[\x7f\x80-\x9e]" "\x80") 0))
596 ;; Used to succeed even with the bug. 597 ;; Used to succeed even with the bug.
597 (Assert-eql (string-match "[\x7f\x80\x9f]" "\x80") 0) 598 (Assert (eql (string-match "[\x7f\x80\x9f]" "\x80") 0))
598 (Assert-eql (string-match "[\x7e\x80-\x9f]" "\x80") 0) 599 (Assert (eql (string-match "[\x7e\x80-\x9f]" "\x80") 0))
599 (Assert-eql (string-match "[\x7f\x81-\x9f]" "\x81") 0) 600 (Assert (eql (string-match "[\x7f\x81-\x9f]" "\x81") 0))