SUPERSEDES APPROVE COMMIT 21.5 RECOMMEND 21.4
Please FUT xemacs-beta (Reply-To set).
>>>> "DU" == Daiki Ueno <daiki(a)xemacs.org>
writes:
tests/ChangeLog addition:
2002-12-24 Daiki Ueno <daiki(a)xemacs.org>
* automated/regexp-tests.el: Add a couple of cases which fail with
the current 21.5 MULE.
Thanks for refining the test case, and for the new test suite cases!
It looks to me like what is happening is that the character classes
are matching Mule characters on the basis of the low-order byte. Note
that with an odd high octet, bit 7 of the Mule Emchar is 1, and Emchar
ch1 truncated to the low octet != ?A. (I suspect that the trivial [A]
case does not assert against ch0 because it gets optimized to a pure
string match.) It seems to be specific to classes, not the regexp
engine in general, because forcing a regexp match instead of a string
match with the "@?A" format doesn't assert.
Unfortunately I won't have time to work on this for a while, so feel
free to fix. :-) Ben gets back in mid-January, he probably won't be
able to work on it until late January at the earliest.
I've rewritten the patch pretty much completely, and suggest the
following hints for writing tests:
1. Include related successful cases. Fixes often break something.
2. Use the Known-Bug-Expect-Failure macro to mark the cases you know
are going to fail. We want to be able to distinguish between
regressions and other unexpected failures, and cases that have
been (partially) analyzed but not yet repaired.
3. Mark the bug with the date of report. I plan to add an "Unfixed
since yyyy-mm-dd" gloss to Known-Bug-Expect-Failure to further
increase developer embarrassment (== incentive to fix the bug),
but until then at least put a comment about the date so we can
easily see when it was reported.
4. It's a matter of judgement, but I used `eq' instead of `=' for the
successful match cases. My logic is that I don't want failures of
those assertions reported as "other failures" (a wrong-type-arg is
signaled, rather than a null return), I want them reported as
"assertion failures".
Here's my patch:
Index: tests/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/ChangeLog,v
retrieving revision 1.23
diff -u -U0 -r1.23 ChangeLog
--- tests/ChangeLog 11 Nov 2002 15:39:03 -0000 1.23
+++ tests/ChangeLog 27 Dec 2002 06:02:36 -0000
@@ -1 +1,8 @@
-2002-10-19 Stephen Turnbull <steve@tleepslib1>
+2002-12-27 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * automated/regexp-tests.el (Mule character class): New test
+ cases. Based on draft patch by Daiki Ueno <daiki(a)xemacs.org>.
+
+ * automated/test-harness.el (Print-Pass): Comment.
+
+2002-10-19 Stephen J. Turnbull <stephen(a)xemacs.org>
Index: tests/automated/test-harness.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/test-harness.el,v
retrieving revision 1.7
diff -u -r1.7 test-harness.el
--- tests/automated/test-harness.el 11 Nov 2002 15:39:07 -0000 1.7
+++ tests/automated/test-harness.el 27 Dec 2002 06:02:04 -0000
@@ -158,6 +158,7 @@
(defun Print-Pass (fmt &rest args)
(setq fmt (concat "PASS: " fmt))
+ ;; #### should warn if expecting failure here!
(and test-harness-verbose
(princ (concat (apply #'format fmt args) "\n"))))
Index: tests/automated/regexp-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/regexp-tests.el,v
retrieving revision 1.4
diff -u -r1.4 regexp-tests.el
--- tests/automated/regexp-tests.el 11 Nov 2002 15:39:07 -0000 1.4
+++ tests/automated/regexp-tests.el 27 Dec 2002 06:02:04 -0000
@@ -221,7 +221,7 @@
(insert "ab")
(goto-char (point-min))
(re-search-forward "\\(a\\)")
- ;; test the whole-match data, too -- one try scotched that, too!
+ ;; test the whole-match data, too -- one attempted fix scotched that, too!
(Assert (string= (match-string 0) "a"))
(Assert (string= (match-string 1) "a"))
(re-search-forward "b")
@@ -249,8 +249,33 @@
(Assert (not (string-match "\\> " " ")))
(Assert (not (string-match "a\\<" "a")))
(Assert (not (string-match "\\>a" "a")))
+;; Added Known-Bug 2002-09-09
(Known-Bug-Expect-Failure
(Assert (not (string-match "\\b" "")))
(Assert (not (string-match "\\b" " ")))
(Assert (not (string-match " \\b" " ")))
(Assert (not (string-match "\\b " " "))))
+
+;; Character classes are broken in Mule as of 21.5.9
+;; Added Known-Bug 2002-12-27
+(if (featurep 'mule)
+ ;; note: (int-to-char 65) => ?A
+ (let ((ch0 (make-char 'japanese-jisx0208 52 65))
+ (ch1 (make-char 'japanese-jisx0208 51 65)))
+ (Assert (not (string-match "A" (string ch0))))
+ (Assert (not (string-match "[A]" (string ch0))))
+ (Known-Bug-Expect-Failure
+ (Assert (eq (string-match "[^A]" (string ch0)) 0)))
+ (Assert (not (string-match "@A" (string ?@ ch0))))
+ (Known-Bug-Expect-Failure
+ (Assert (not (string-match "@[A]" (string ?@ ch0)))))
+ (Known-Bug-Expect-Failure
+ (Assert (eq (string-match "@[^A]" (string ?@ ch0)) 0)))
+ (Assert (not (string-match "@?A" (string ?@ ch0))))
+ (Assert (not (string-match "A" (string ch1))))
+ (Assert (not (string-match "[A]" (string ch1))))
+ (Assert (eq (string-match "[^A]" (string ch1)) 0))
+ (Assert (not (string-match "@A" (string ?@ ch1))))
+ (Assert (not (string-match "@[A]" (string ?@ ch1))))
+ (Assert (eq (string-match "@[^A]" (string ?@ ch1)) 0))
+ (Assert (not (string-match "@?A" (string ?@ ch1))))))
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.