diff tests/automated/mule-tests.el @ 4623:a9f83990e6bf

Fix a byte compiler bug with characters above ?\xFF. lisp/ChangeLog addition: 2009-02-22 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-force-escape-quoted): New variable, used to force `byte-compile-insert-header' to treat the output as having characters above ?\xFF. (byte-compile-from-buffer): If the compiled output contains characters above ?\xFF, and byte-compile-dynamic-docstrings or byte-compile-dynamic is non-nil (or we're using an inappropriate coding system) recompile the file, turning off the dynamic features and using a more appropriate header. (byte-compile-insert-header): Pay attention to byte-compile-force-escape-quoted. tests/ChangeLog addition: 2009-02-22 Aidan Kehoe <kehoea@parhasard.net> * automated/mule-tests.el: Use more realistic tests for the escape-quoted mule encoding checks; update a comment, change a Known-Bug-Expect-Failure to a normal test now that we've addressed an old bug.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 22 Feb 2009 19:57:28 +0000
parents 4dc42d1fe684
children e4ed58cb0e5b
line wrap: on
line diff
--- a/tests/automated/mule-tests.el	Wed Feb 18 07:53:34 2009 +0000
+++ b/tests/automated/mule-tests.el	Sun Feb 22 19:57:28 2009 +0000
@@ -599,30 +599,24 @@
         ((Assert-elc-is-escape-quoted ()
            "Assert the current buffer has an escape-quoted cookie if compiled."
            (save-excursion
-             (let ((byte-compile-result (byte-compile-from-buffer
-                                         (current-buffer) nil nil))
-                   (temporary-file-name (make-temp-name
-                                         (expand-file-name "zjPQ2Pk"
-                                                           (temp-directory)))))
-               (byte-compile-insert-header
-                temporary-file-name
-                (current-buffer)
-                byte-compile-result)
+             (let* ((temporary-file-name (make-temp-name
+					  (expand-file-name "zjPQ2Pk"
+							    (temp-directory))))
+		    (byte-compile-result (byte-compile-from-buffer
+					  (current-buffer) temporary-file-name
+					  nil)))
                (Assert (string-match
                         "^;;;###coding system: escape-quoted"
                         (buffer-substring nil nil byte-compile-result))))))
          (Assert-elc-has-no-specified-encoding ()
            "Assert the current buffer has no coding cookie if compiled."
            (save-excursion
-             (let ((byte-compile-result (byte-compile-from-buffer
-                                         (current-buffer) nil nil))
-                   (temporary-file-name (make-temp-name
-                                         (expand-file-name "zjPQ2Pk"
-                                                           (temp-directory)))))
-               (byte-compile-insert-header
-                temporary-file-name
-                (current-buffer)
-                byte-compile-result)
+             (let* ((temporary-file-name (make-temp-name
+					  (expand-file-name "zjPQ2Pk"
+							    (temp-directory))))
+		    (byte-compile-result (byte-compile-from-buffer
+					  (current-buffer) temporary-file-name
+					  nil)))
                (Assert (not (string-match
                              ";;;###coding system:"
                              (buffer-substring nil nil
@@ -703,8 +697,8 @@
       (Assert-elc-has-no-specified-encoding)
       (delete-region (point-min) (point-max))
 
-      ;; This bug exists because the coding-cookie insertion code looks at
-      ;; the input buffer, not the output buffer.
+      ;; There used to be a bug here because the coding-cookie insertion code
+      ;; looks at the input buffer, not the output buffer.
       ;;
       ;; It looks at the input buffer because byte-compile-dynamic and
       ;; byte-compile-dynamic-docstrings currently need to be
@@ -712,19 +706,20 @@
       ;; compilation of function bodies and docstrings fails if you can't
       ;; call (point) and trivially get the byte offset in the file.
       ;;
-      ;; And to unconditionally turn those two features off, you need to
-      ;; know before byte-compilation whether the byte-compilation output
-      ;; file contains non-Latin-1 characters, or perhaps to check after
-      ;; compilation and redo; but we don't do the latter.
+      ;; And to unconditionally turn those two features off, you need to know
+      ;; before byte-compilation whether the byte-compilation output file
+      ;; contains non-Latin-1 characters. Or to check after compilation and
+      ;; redo; the latter is what we do right now. This will only be necessary
+      ;; in a very small minority of cases, it's not a performance-critical
+      ;; issue.
       ;; 
-      ;; To fix this bug, we need to add Mule support to
-      ;; byte-compile-dynamic and byte-compile-dynamic-docstrings. Or drop
-      ;; support for those features entirely.
+      ;; Martin Buchholz thinks, in bytecomp.el, that we should implement lazy
+      ;; loading for Mule files; I (Aidan Kehoe) don't think that's worth the
+      ;; effort today (February 2009).
       (insert
        "(defvar testing-mule-compilation-handling (eval-when-compile
 	(decode-char 'ucs #x371e))) ;; kDefinition beautiful; pretty, used\"")
-      (Known-Bug-Expect-Failure
-       (Assert-elc-is-escape-quoted))
+      (Assert-elc-is-escape-quoted)
       (delete-region (point-min) (point-max))))
 
   (Known-Bug-Expect-Error