[PATCH] Fix the test failures introduced by the non-ISO-2022 coding systems

Aidan Kehoe kehoea at parhasard.net
Thu Dec 6 16:08:38 EST 2007




src/ChangeLog addition:

2007-12-06  Aidan Kehoe  <kehoea at parhasard.net>

	* tests.c (Ftest_data_format_conversion):
	Move those tests that expect that iso-8859-2 is ISO
	2022-compatible to testing iso-latin-2-with-esc instead. 


tests/ChangeLog addition:

2007-12-06  Aidan Kehoe  <kehoea at parhasard.net>

	* automated/mule-tests.el:
	Add a Known-Bug-Expect-Error call testing and documenting that we
	don't support all of the Unicode code space in a single session.
	* automated/test-harness.el (Known-Bug-Expect-Error):
	Provide Known-Bug-Expect-Error, analagous to
	Known-Bug-Expect-Failure and Check-Error.
	* automated/test-harness.el (Silence-Message):	
	Dynamically bind the function definition of #'clear-message, as
	well as that of #'append-message, to nil.


XEmacs Trunk source patch:
Diff command:   cvs -q diff -Nu
Files affected: tests/automated/test-harness.el
===================================================================
RCS tests/automated/mule-tests.el
===================================================================
RCS src/tests.c
===================================================================
RCS

Index: src/tests.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/tests.c,v
retrieving revision 1.13
diff -u -u -r1.13 tests.c
--- src/tests.c	2006/05/23 13:02:07	1.13
+++ src/tests.c	2007/12/06 20:48:44
@@ -37,7 +37,6 @@
 
 static Lisp_Object Vtest_function_list;
 
-
 DEFUN ("test-data-format-conversion", Ftest_data_format_conversion, 0, 0, "", /*
 Test TO_EXTERNAL_FORMAT() and TO_INTERNAL_FORMAT()
 */
@@ -70,6 +69,9 @@
 
   /* Check for expected strings before and after conversion.
      Conversions depend on whether MULE is defined. */
+
+  /* #### Any code below that uses iso-latin-2-with-esc is ill-conceived. */
+
 #ifdef MULE
 #define DFC_CHECK_DATA_COND_MULE(ptr,len,			\
 				 constant_string_mule,		\
@@ -137,7 +139,7 @@
   ptr = NULL, len = rand();
   TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
 		      ALLOCA, (ptr, len),
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA (ptr, len, ext_latin12);
 
   ptr = NULL, len = rand();
@@ -155,34 +157,34 @@
   ptr = NULL, len = rand();
   TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
 		      ALLOCA, (ptr, len),
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA (ptr, len, int_latin2);
 
   ptr = NULL, len = rand();
   TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
 		      MALLOC, (ptr, len),
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA (ptr, len, int_latin2);
   xfree (ptr, void *);
 
   TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
 		      LISP_STRING, string,
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA (XSTRING_DATA (string), XSTRING_LENGTH (string), int_latin2);
 
   TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_latin,
 		      LISP_STRING, string,
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA (XSTRING_DATA (string), XSTRING_LENGTH (string), int_latin2);
 
   TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque0_latin,
 		      LISP_STRING, string,
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA_NUL (XSTRING_DATA (string), XSTRING_LENGTH (string), int_latin2);
 
   TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque0_latin,
 		      LISP_BUFFER, Fcurrent_buffer(),
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA_NUL (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)),
 		    sizeof (int_latin2), int_latin2);
 
@@ -194,7 +196,7 @@
 
   TO_INTERNAL_FORMAT (DATA, (ext_latin12, sizeof (ext_latin12) - 1),
 		      ALLOCA, (ptr, len),
-		      intern ("iso-8859-2"));
+		      intern ("iso-latin-2-with-esc"));
   DFC_CHECK_DATA (ptr, len, int_latin1);
 
 #endif /* MULE */
Index: tests/automated/mule-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/mule-tests.el,v
retrieving revision 1.22
diff -u -u -r1.22 mule-tests.el
--- tests/automated/mule-tests.el	2007/12/04 20:40:51	1.22
+++ tests/automated/mule-tests.el	2007/12/06 20:48:44
@@ -721,4 +721,17 @@
       (Known-Bug-Expect-Failure
        (Assert-elc-is-escape-quoted))
       (delete-region (point-min) (point-max))))
+
+  (Known-Bug-Expect-Error
+   invalid-constant
+   (loop
+     for i from #x0 to #x10FFFF 
+     with exceptions = #s(range-table type start-closed-end-closed
+                                      data ((#xFFFE #xFFFF) t
+                                            (#xFDD0 #xFDEF) t
+                                            (#xD800 #xDBFF) t
+                                            (#xDC00 #xDFFF) t))
+     do (unless (get-range-table i exceptions)
+          (read (format (if (> i #xFFFF) #r"?\U%08X" #r"?\u%04X") i)))
+     finally return t))
   )
Index: tests/automated/test-harness.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/test-harness.el,v
retrieving revision 1.23
diff -u -u -r1.23 test-harness.el
--- tests/automated/test-harness.el	2007/10/01 08:07:57	1.23
+++ tests/automated/test-harness.el	2007/12/06 20:48:45
@@ -203,7 +203,29 @@
 	`(let ((test-harness-failure-tag "KNOWN BUG")
 	       (test-harness-success-tag "PASS (FAILURE EXPECTED)"))
 	  , at body))
-    
+
+      (defmacro Known-Bug-Expect-Error (expected-error &rest body)
+	(let ((quoted-body (if (= 1 (length body))
+			       `(quote ,(car body)) `(quote (progn , at body)))))
+          `(let ((test-harness-failure-tag "KNOWN BUG")
+                 (test-harness-success-tag "PASS (FAILURE EXPECTED)"))
+            (condition-case error-info
+                (progn
+                  (setq trick-optimizer (progn , at body))
+                  (Print-Pass 
+                   "%S executed successfully, but expected error %S"
+                   ,quoted-body
+                   ',expected-error)
+                  (incf passes))
+              (,expected-error
+               (Print-Failure "%S ==> error %S, as expected"
+                              ,quoted-body ',expected-error)
+               (incf no-error-failures))
+              (error
+               (Print-Failure "%S ==> expected error %S, got error %S instead"
+                              ,quoted-body ',expected-error error-info)
+               (incf wrong-error-failures))))))
+
       (defmacro Implementation-Incomplete-Expect-Failure (&rest body)
 	`(let ((test-harness-failure-tag "IMPLEMENTATION INCOMPLETE")
 	       (test-harness-success-tag "PASS (FAILURE EXPECTED)"))
@@ -337,7 +359,9 @@
 
       ;; #### Perhaps this should override `message' itself, too?
       (defmacro Silence-Message (&rest body)
-	`(flet ((append-message (&rest args) ())) , at body))
+	`(flet ((append-message (&rest args) ())
+                (clear-message (&rest args) ()))
+          , at body))
 
       (defmacro Ignore-Ebola (&rest body)
 	`(let ((debug-issue-ebola-notices -42)) , at body))

-- 
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?



More information about the XEmacs-Patches mailing list