Mercurial > hg > xemacs-beta
view tests/automated/mule-tests.el @ 1318:b531bf8658e9
[xemacs-hg @ 2003-02-21 06:56:46 by ben]
redisplay fixes et al.
PROBLEMS: Add comment about Cygwin, unexec and sysmalloc.
Move some non-general stuff out of general.
Make a section for x86.
configure.in: Add check for broken alloca in funcalls.
mule/mule-cmds.el: Alias file-name to native not vice-versa.
Do set EOL of native but not of process output to fix various
problems and be consistent with code-init.el.
code-cmds.el: Return a name not a coding system.
code-init.el: Reindent. Remove `file-name' since it should always be the same
as native.
unicode.el: Rename to load-unicode-mapping-table as suggested by the anonymous
(but rather Turnbullian) comment in unicode.c.
xemacs.dsp: Add /k to default build.
alloc.c: Make gc_currently_forbidden static.
config.h.in, lisp.h: Move some stuff to lisp.h.
console-gtk.h, console-impl.h, console-msw.h, console-x.h, event-Xt.c, event-msw.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, gtk-xemacs.c: Remove duplicated code to redraw exposed area. Add deadbox
method needed by the generalized redraw code. Defer redrawing
if already in redisplay.
frame-msw.c, event-stream.c, frame.c: Add comments about calling Lisp.
debug.c, general-slots.h: Move generalish symbols to general-slots.h.
doprnt.c: reindent.
lisp.h, dynarr.c: Add debug code for locking a dynarr to catch invalid mods.
Use in redisplay.c.
eval.c:
file-coding.c: Define file-name as alias for native not vice-versa.
frame-gtk.c, frame-x.c: Move Qwindow_id to general-slots.
dialog-msw.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, gui.c, gui.h, menubar-msw.c, menubar.c: Ensure that various glyph functions that eval within redisplay
protect the evals. Same for calls to internal_equal().
Modify various functions, e.g. gui_item_*(), to protect evals
within redisplay, taking an in_redisplay parameter if it's
possible for them to be called both inside and outside of
redisplay.
gutter.c: Defer specifier-changed updating till after redisplay, if
necessary, since we need to enter redisplay to do it.
gutter.c: Do nothing if in redisplay.
lisp.h: Add version of alloca() for use in function calls.
lisp.h: Add XCAD[D+]R up to 6 D's, and aliases X1ST, X2ND, etc.
frame.c, frame.h, redisplay.c, redisplay.h, signal.c, toolbar.c: Redo critical-section code and move from frame.c to redisplay.c.
Require that every place inside of redisplay catch errors itself,
not at the edge of the critical section (thereby bypassing the
rest of redisplay and leaving things in an inconsistent state).
Introduce separate means of holding frame-size changes without
entering a complete critical section. Introduce "post-redisplay"
methods for deferring things till after redisplay. Abort if
we enter redisplay reentrantly. Disable all quit checking in
redisplay since it's too dangerous. Ensure that all calls to
QUIT trigger an abort if unprotected.
redisplay.c, scrollbar-gtk.c, scrollbar-x.c, scrollbar.c: Create enter/exit_redisplay_critical_section_maybe() for code
that needs to ensure it's in a critical section but doesn't
interfere with an existing critical section.
sysdep.c: Use _wexecve() when under Windows NT for Unicode correctness.
text.c, text.h: Add new_dfc() functions, which return an alloca()ed value rather
than requiring an lvalue. (Not really used yet; used in another
workspace, to come.) Add some macros for SIZED_EXTERNAL.
Update the encoding aliases after involved scrutinization of the
X manual.
unicode.c: Answer the anonymous but suspiciously Turnbullian questions.
Rename parse-unicode-translation-table to
load-unicode-mapping-table, as suggested.
author | ben |
---|---|
date | Fri, 21 Feb 2003 06:57:21 +0000 |
parents | 59e2c5b1e38f |
children | ca02e61c9829 |
line wrap: on
line source
;; Copyright (C) 1999 Free Software Foundation, Inc. ;; Author: Hrvoje Niksic <hniksic@xemacs.org> ;; Maintainers: Hrvoje Niksic <hniksic@xemacs.org>, ;; Martin Buchholz <martin@xemacs.org> ;; Created: 1999 ;; Keywords: tests ;; This file is part of XEmacs. ;; XEmacs is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; XEmacs is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with XEmacs; see the file COPYING. If not, write to the Free ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ;; 02111-1307, USA. ;;; Synched up with: Not in FSF. ;;; Commentary: ;; Test some Mule functionality (most of these remain to be written) . ;; See test-harness.el for instructions on how to run these tests. ;; This file will be (read)ed by a non-mule XEmacs, so don't use ;; literal non-Latin1 characters. Use (make-char) instead. ;;----------------------------------------------------------------- ;; Test whether all legal chars may be safely inserted to a buffer. ;;----------------------------------------------------------------- (defun test-chars (&optional for-test-harness) "Insert all characters in a buffer, to see if XEmacs will crash. This is done by creating a string with all the legal characters in [0, 2^19) range, inserting it into the buffer, and checking that the buffer's contents are equivalent to the string. If FOR-TEST-HARNESS is specified, a temporary buffer is used, and the Assert macro checks for correctness." (let ((max (expt 2 (if (featurep 'mule) 19 8))) (list nil) (i 0)) (while (< i max) (and (not for-test-harness) (zerop (% i 1000)) (message "%d" i)) (and (int-char i) ;; Don't aset to a string directly because random string ;; access is O(n) under Mule. (setq list (cons (int-char i) list))) (setq i (1+ i))) (let ((string (apply #'string (nreverse list)))) (if for-test-harness ;; For use with test-harness, use Assert and a temporary ;; buffer. (with-temp-buffer (insert string) (Assert (equal (buffer-string) string))) ;; For use without test harness: use a normal buffer, so that ;; you can also test whether redisplay works. (switch-to-buffer (get-buffer-create "test")) (erase-buffer) (buffer-disable-undo) (insert string) (assert (equal (buffer-string) string)))))) ;; It would be really *really* nice if test-harness allowed a way to ;; run a test in byte-compiled mode only. It's tedious to have ;; time-consuming tests like this one run twice, once interpreted and ;; once compiled, for no good reason. (test-chars t) ;;----------------------------------------------------------------- ;; Test string modification functions that modify the length of a char. ;;----------------------------------------------------------------- (when (featurep 'mule) ;;--------------------------------------------------------------- ;; Test fillarray ;;--------------------------------------------------------------- (macrolet ((fillarray-test (charset1 charset2) (let ((char1 (make-char charset1 69)) (char2 (make-char charset2 69))) `(let ((string (make-string 1000 ,char1))) (fillarray string ,char2) (Assert (eq (aref string 0) ,char2)) (Assert (eq (aref string (1- (length string))) ,char2)) (Assert (eq (length string) 1000)))))) (fillarray-test ascii latin-iso8859-1) (fillarray-test ascii latin-iso8859-2) (fillarray-test latin-iso8859-1 ascii) (fillarray-test latin-iso8859-2 ascii)) ;; Test aset (let ((string (string (make-char 'ascii 69) (make-char 'latin-iso8859-2 69)))) (aset string 0 (make-char 'latin-iso8859-2 42)) (Assert (eq (aref string 1) (make-char 'latin-iso8859-2 69)))) ;;--------------------------------------------------------------- ;; Test coding system functions ;;--------------------------------------------------------------- ;; Create alias for coding system without subsidiaries (Assert (coding-system-p (find-coding-system 'binary))) (Assert (coding-system-canonical-name-p 'binary)) (Assert (not (coding-system-alias-p 'binary))) (Assert (not (coding-system-alias-p 'mule-tests-alias))) (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) (Check-Error-Message error "Symbol is the canonical name of a coding system and cannot be redefined" (define-coding-system-alias 'binary 'iso8859-2)) (Check-Error-Message error "Symbol is not a coding system alias" (coding-system-aliasee 'binary)) (define-coding-system-alias 'mule-tests-alias 'binary) (Assert (coding-system-alias-p 'mule-tests-alias)) (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) (Assert (eq (get-coding-system 'binary) (get-coding-system 'mule-tests-alias))) (Assert (eq 'binary (coding-system-aliasee 'mule-tests-alias))) (Assert (not (coding-system-alias-p 'mule-tests-alias-unix))) (Assert (not (coding-system-alias-p 'mule-tests-alias-dos))) (Assert (not (coding-system-alias-p 'mule-tests-alias-mac))) (define-coding-system-alias 'mule-tests-alias (get-coding-system 'binary)) (Assert (coding-system-alias-p 'mule-tests-alias)) (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) (Assert (eq (get-coding-system 'binary) (get-coding-system 'mule-tests-alias))) (Assert (eq 'binary (coding-system-aliasee 'mule-tests-alias))) (Assert (not (coding-system-alias-p 'mule-tests-alias-unix))) (Assert (not (coding-system-alias-p 'mule-tests-alias-dos))) (Assert (not (coding-system-alias-p 'mule-tests-alias-mac))) (define-coding-system-alias 'nested-mule-tests-alias 'mule-tests-alias) (Assert (coding-system-alias-p 'nested-mule-tests-alias)) (Assert (not (coding-system-canonical-name-p 'nested-mule-tests-alias))) (Assert (eq (get-coding-system 'binary) (get-coding-system 'nested-mule-tests-alias))) (Assert (eq (coding-system-aliasee 'nested-mule-tests-alias) 'mule-tests-alias)) (Assert (eq 'mule-tests-alias (coding-system-aliasee 'nested-mule-tests-alias))) (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-unix))) (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-dos))) (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-mac))) (Check-Error-Message error "Attempt to create a coding system alias loop" (define-coding-system-alias 'mule-tests-alias 'nested-mule-tests-alias)) (Check-Error-Message error "No such coding system" (define-coding-system-alias 'no-such-coding-system 'no-such-coding-system)) (Check-Error-Message error "Attempt to create a coding system alias loop" (define-coding-system-alias 'mule-tests-alias 'mule-tests-alias)) (define-coding-system-alias 'nested-mule-tests-alias nil) (define-coding-system-alias 'mule-tests-alias nil) (Assert (coding-system-p (find-coding-system 'binary))) (Assert (coding-system-canonical-name-p 'binary)) (Assert (not (coding-system-alias-p 'binary))) (Assert (not (coding-system-alias-p 'mule-tests-alias))) (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) (Check-Error-Message error "Symbol is the canonical name of a coding system and cannot be redefined" (define-coding-system-alias 'binary 'iso8859-2)) (Check-Error-Message error "Symbol is not a coding system alias" (coding-system-aliasee 'binary)) (define-coding-system-alias 'nested-mule-tests-alias nil) (define-coding-system-alias 'mule-tests-alias nil) ;; Create alias for coding system with subsidiaries (define-coding-system-alias 'mule-tests-alias 'iso-8859-7) (Assert (coding-system-alias-p 'mule-tests-alias)) (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) (Assert (eq (get-coding-system 'iso-8859-7) (get-coding-system 'mule-tests-alias))) (Assert (eq 'iso-8859-7 (coding-system-aliasee 'mule-tests-alias))) (Assert (coding-system-alias-p 'mule-tests-alias-unix)) (Assert (coding-system-alias-p 'mule-tests-alias-dos)) (Assert (coding-system-alias-p 'mule-tests-alias-mac)) (define-coding-system-alias 'mule-tests-alias (get-coding-system 'iso-8859-7)) (Assert (coding-system-alias-p 'mule-tests-alias)) (Assert (not (coding-system-canonical-name-p 'mule-tests-alias))) (Assert (eq (get-coding-system 'iso-8859-7) (get-coding-system 'mule-tests-alias))) (Assert (eq 'iso-8859-7 (coding-system-aliasee 'mule-tests-alias))) (Assert (coding-system-alias-p 'mule-tests-alias-unix)) (Assert (coding-system-alias-p 'mule-tests-alias-dos)) (Assert (coding-system-alias-p 'mule-tests-alias-mac)) (Assert (eq (find-coding-system 'mule-tests-alias-mac) (find-coding-system 'iso-8859-7-mac))) (define-coding-system-alias 'nested-mule-tests-alias 'mule-tests-alias) (Assert (coding-system-alias-p 'nested-mule-tests-alias)) (Assert (not (coding-system-canonical-name-p 'nested-mule-tests-alias))) (Assert (eq (get-coding-system 'iso-8859-7) (get-coding-system 'nested-mule-tests-alias))) (Assert (eq (coding-system-aliasee 'nested-mule-tests-alias) 'mule-tests-alias)) (Assert (eq 'mule-tests-alias (coding-system-aliasee 'nested-mule-tests-alias))) (Assert (coding-system-alias-p 'nested-mule-tests-alias-unix)) (Assert (coding-system-alias-p 'nested-mule-tests-alias-dos)) (Assert (coding-system-alias-p 'nested-mule-tests-alias-mac)) (Assert (eq (find-coding-system 'nested-mule-tests-alias-unix) (find-coding-system 'iso-8859-7-unix))) (Check-Error-Message error "Attempt to create a coding system alias loop" (define-coding-system-alias 'mule-tests-alias 'nested-mule-tests-alias)) (Check-Error-Message error "No such coding system" (define-coding-system-alias 'no-such-coding-system 'no-such-coding-system)) (Check-Error-Message error "Attempt to create a coding system alias loop" (define-coding-system-alias 'mule-tests-alias 'mule-tests-alias)) ;; Test dangling alias deletion (define-coding-system-alias 'mule-tests-alias nil) (Assert (not (coding-system-alias-p 'mule-tests-alias))) (Assert (not (coding-system-alias-p 'mule-tests-alias-unix))) (Assert (not (coding-system-alias-p 'nested-mule-tests-alias))) (Assert (not (coding-system-alias-p 'nested-mule-tests-alias-dos))) ;;--------------------------------------------------------------- ;; Test strings waxing and waning across the 8k BIG_STRING limit (see alloc.c) ;;--------------------------------------------------------------- (defun charset-char-string (charset) (let (lo hi string n) (if (= (charset-chars charset) 94) (setq lo 33 hi 126) (setq lo 32 hi 127)) (if (= (charset-dimension charset) 1) (progn (setq string (make-string (1+ (- hi lo)) ??)) (setq n 0) (loop for j from lo to hi do (progn (aset string n (make-char charset j)) (incf n))) string) (progn (setq string (make-string (* (1+ (- hi lo)) (1+ (- hi lo))) ??)) (setq n 0) (loop for j from lo to hi do (loop for k from lo to hi do (progn (aset string n (make-char charset j k)) (incf n)))) string)))) ;; The following two used to crash xemacs! (Assert (charset-char-string 'japanese-jisx0208)) (aset (make-string 9003 ??) 1 (make-char 'latin-iso8859-1 77)) (let ((greek-string (charset-char-string 'greek-iso8859-7)) (string (make-string (* 96 60) ??))) (loop for j from 0 below (length string) do (aset string j (aref greek-string (mod j 96)))) (loop for k in '(0 1 58 59) do (Assert (equal (substring string (* 96 k) (* 96 (1+ k))) greek-string)))) (let ((greek-string (charset-char-string 'greek-iso8859-7)) (string (make-string (* 96 60) ??))) (loop for j from (1- (length string)) downto 0 do (aset string j (aref greek-string (mod j 96)))) (loop for k in '(0 1 58 59) do (Assert (equal (substring string (* 96 k) (* 96 (1+ k))) greek-string)))) (let ((ascii-string (charset-char-string 'ascii)) (string (make-string (* 94 60) (make-char 'greek-iso8859-7 57)))) (loop for j from 0 below (length string) do (aset string j (aref ascii-string (mod j 94)))) (loop for k in '(0 1 58 59) do (Assert (equal (substring string (* 94 k) (+ 94 (* 94 k))) ascii-string)))) (let ((ascii-string (charset-char-string 'ascii)) (string (make-string (* 94 60) (make-char 'greek-iso8859-7 57)))) (loop for j from (1- (length string)) downto 0 do (aset string j (aref ascii-string (mod j 94)))) (loop for k in '(0 1 58 59) do (Assert (equal (substring string (* 94 k) (* 94 (1+ k))) ascii-string)))) ;;--------------------------------------------------------------- ;; Test file-system character conversion (and, en passant, file ops) ;;--------------------------------------------------------------- (let* ((scaron (make-char 'latin-iso8859-2 57)) (latin2-string (make-string 4 scaron)) (prefix (concat (file-name-as-directory (file-truename (temp-directory))) latin2-string)) (name1 (make-temp-name prefix)) (name2 (make-temp-name prefix)) (file-name-coding-system 'iso-8859-2)) ;; This is how you suppress output from `message', called by `write-region' (flet ((append-message (&rest args) ())) (Assert (not (equal name1 name2))) (Assert (not (file-exists-p name1))) (write-region (point-min) (point-max) name1) (Assert (file-exists-p name1)) (when (fboundp 'make-symbolic-link) (make-symbolic-link name1 name2) (Assert (file-exists-p name2)) (Assert (equal (file-truename name2) name1)) (Assert (equal (file-truename name1) name1))) (ignore-file-errors (delete-file name1) (delete-file name2)))) ;; Add many more file operation tests here... ;;--------------------------------------------------------------- ;; Test Unicode-related functions ;;--------------------------------------------------------------- (let* ((scaron (make-char 'latin-iso8859-2 57))) ;; Used to try #x0000, but you can't change ASCII or Latin-1 (loop for code in '(#x0100 #x2222 #x4444 #xffff) do (progn (set-unicode-conversion scaron code) (Assert (eq code (char-to-unicode scaron))) (Assert (eq scaron (unicode-to-char code '(latin-iso8859-2)))))) (Check-Error wrong-type-argument (set-unicode-conversion scaron -10000))) ;;--------------------------------------------------------------- ;; Test charset-in-* functions ;;--------------------------------------------------------------- (with-temp-buffer (insert-file-contents (locate-data-file "HELLO")) ;; #### rewrite robustly, both assume that the tested implementation ;; uses the same algorithm as was used by the version current at time ;; this test was written (Assert (equal (charsets-in-region (point-min) (point-max)) '(korean-ksc5601 chinese-big5-1 chinese-gb2312 japanese-jisx0212 katakana-jisx0201 japanese-jisx0208 vietnamese-viscii-lower thai-xtis cyrillic-iso8859-5 hebrew-iso8859-8 greek-iso8859-7 latin-iso8859-1 latin-iso8859-2 arabic-2-column arabic-1-column ethiopic ascii))) (Assert (equal (charsets-in-string (buffer-substring (point-min) (point-max))) '(korean-ksc5601 chinese-big5-1 chinese-gb2312 japanese-jisx0212 katakana-jisx0201 japanese-jisx0208 vietnamese-viscii-lower thai-xtis cyrillic-iso8859-5 hebrew-iso8859-8 greek-iso8859-7 latin-iso8859-1 latin-iso8859-2 arabic-2-column arabic-1-column ethiopic ascii)))) )