Mercurial > hg > xemacs-beta
annotate tests/automated/lisp-reader-tests.el @ 5598:bccc91a65536
Fix .gdbinit and .dbxrc when using the new garbage collector.
ChangeLog:
2011-11-21 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
* configure.ac: Fix creation of etc/dbxrc and src/.dbxrc; only try
to create Makefile when Makefile.in is there.
* configure: Regenerate.
src/ChangeLog:
2011-11-21 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
* .gdbinit.in.in: There is no lrecord_type_lcrecord_list when
using the new garbage collector; print $lrecord_type when Lisp
Object type is unknown to pobj.
etc/ChangeLog:
2011-11-21 Marcus Crestani <crestani@informatik.uni-tuebingen.de>
* dbxrc.in: There is no lrecord_type_lcrecord_list when using the
new garbage collector; print $lrecord_type when Lisp Object type
is unknown to pobj.
| author | Marcus Crestani <crestani@informatik.uni-tuebingen.de> |
|---|---|
| date | Mon, 21 Nov 2011 10:28:31 +0100 |
| parents | 58b38d5b32d0 |
| children | cc7f8a0e569a |
| rev | line source |
|---|---|
| 3543 | 1 ;; Copyright (C) 2005 Martin Kuehl. |
| 2 | |
| 3 ;; Author: Martin Kuehl <martin.kuehl@gmail.com> | |
| 4 ;; Maintainer: Martin Kuehl <martin.kuehl@gmail.com> | |
| 5 ;; Created: 2005 | |
| 6 ;; Keywords: tests | |
| 7 | |
|
5290
e6508b64ee08
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
3543
diff
changeset
|
8 ;; This file is part of XEmacs. |
| 3543 | 9 |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
10 ;; XEmacs is free software: you can redistribute it and/or modify it |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
11 ;; under the terms of the GNU General Public License as published by the |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
12 ;; Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
13 ;; option) any later version. |
| 3543 | 14 |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
15 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
17 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
18 ;; for more details. |
| 3543 | 19 |
| 20 ;; You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
3543
diff
changeset
|
21 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
| 3543 | 22 |
| 23 ;;; Synched up with: Not in FSF. | |
| 24 | |
| 25 ;;; Commentary: | |
| 26 | |
| 27 ;; Test the lisp reader. | |
| 28 ;; See test-harness.el for instructions on how to run these tests. | |
| 29 | |
| 30 ;;; Raw Strings | |
| 31 ;;; =========== | |
| 32 | |
| 33 ;; Equality to "traditional" strings | |
| 34 ;; --------------------------------- | |
| 35 (dolist (strings '((#r"xyz" "xyz") ; no backslashes | |
| 36 (#r"\xyz" "\\xyz") ; backslash at start | |
| 37 (#r"\\xyz" "\\\\xyz") ; backslashes at start | |
| 38 (#r"\nxyz" "\\nxyz") ; escape seq. at start | |
| 39 (#r"\"xyz" "\\\"xyz") ; quote at start | |
| 40 (#r"xy\z" "xy\\z") ; backslash in middle | |
| 41 (#r"xy\\z" "xy\\\\z") ; backslashes in middle | |
| 42 (#r"xy\nz" "xy\\nz") ; escape seq. in middle | |
| 43 (#r"xy\"z" "xy\\\"z") ; quote in middle | |
| 44 ;;(#r"xyz\" "xyz\\") ; backslash at end: error | |
| 45 (#r"xyz\\" "xyz\\\\") ; backslashes at end | |
| 46 (#r"xyz\n" "xyz\\n") ; escape seq. at end | |
| 47 (#r"xyz\"" "xyz\\\"") ; quote at end | |
| 48 (#ru"\u00ABxyz" "\u00ABxyz") ; one Unicode escape | |
| 49 (#rU"\U000000ABxyz" "\U000000ABxyz") ; another Unicode escape | |
| 50 (#rU"xyz\u00AB" "xyz\u00AB") ; one Unicode escape | |
| 51 )) | |
| 52 (Assert (apply #'string= strings))) | |
| 53 | |
| 54 ;; Odd number of backslashes at the end | |
| 55 ;; ------------------------------------ | |
| 56 (dolist (string '("#r\"xyz\\\"" ; `#r"abc\"': escaped delimiter | |
| 57 "#r\"xyz\\\\\\\"" ; `#r"abc\\\"': escaped delimiter | |
| 58 )) | |
| 59 (with-temp-buffer | |
| 60 (insert string) | |
| 61 (Check-Error end-of-file (eval-buffer)))) | |
| 62 | |
| 63 ;; Alternate string/regex delimiters | |
| 64 ;; --------------------------------- | |
| 65 (dolist (string '("#r/xyz/" ; Perl syntax | |
| 66 "#r:ix/xyz/" ; Extended Perl syntax | |
| 67 "#r|xyz|" ; TeX syntax | |
| 68 "#r[xyz]" ; (uncommon) Perl syntax | |
| 69 "#r<xyz>" ; Perl6 syntax? | |
| 70 "#r(xyz)" ; arbitrary santax | |
| 71 "#r{xyz}" ; arbitrary santax | |
| 72 "#r,xyz," ; arbitrary santax | |
| 73 "#r!xyz!" ; arbitrary santax | |
| 74 )) | |
| 75 (with-temp-buffer | |
| 76 (insert string) | |
| 77 (Check-Error-Message invalid-read-syntax "unrecognized raw string" | |
| 78 (eval-buffer)))) | |
|
5489
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
79 |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
80 (when (featurep 'bignum) |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
81 ;; This failed, up to 20110501. |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
82 (Assert (eql (1+ most-positive-fixnum) |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
83 (read (format "+%d" (1+ most-positive-fixnum)))) |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
84 "checking leading + is handled properly if reading a bignum") |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
85 ;; This never did. |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
86 (Assert (eql (1- most-positive-fixnum) |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
87 (read (format "+%d" (1- most-positive-fixnum)))) |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
88 "checking leading + is handled properly if reading a fixnum")) |
|
159face738c3
Never pass a leading + to mpz_set_string, parse_integer ().
Aidan Kehoe <kehoea@parhasard.net>
parents:
5420
diff
changeset
|
89 |
|
5560
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
90 ;; Test print-circle. |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
91 (let ((cons '#1=(1 2 3 4 5 6 . #1#)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
92 (vector #2=[1 2 3 4 5 6 #2#]) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
93 (compiled-function #3=#[(argument) "\xc2\x09\x08\"\x87" |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
94 [pi argument #3#] 3]) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
95 (char-table #4=#s(char-table :type generic :data (?\u0080 #4#))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
96 (hash-table #5=#s(hash-table :test eql :data (a b c #5# e f))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
97 (range-table #6=#s(range-table :type start-closed-end-open |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
98 :data ((#x00 #xff) hello |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
99 (#x100 #x1ff) #6# |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
100 (#x200 #x2ff) everyone))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
101 (print-readably t) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
102 (print-circle t) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
103 deserialized-cons deserialized-vector deserialized-compiled-function |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
104 deserialized-char-table deserialized-hash-table deserialized-range-table) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
105 (Assert (eq (nthcdr 6 cons) cons) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
106 "checking basic recursive cons read properly") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
107 (Assert (eq vector (aref vector (1- (length vector)))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
108 "checking basic recursive vector read properly") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
109 (Assert (eq compiled-function |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
110 (find-if #'compiled-function-p |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
111 (compiled-function-constants compiled-function))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
112 "checking basic recursive compiled-function read properly") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
113 (Check-Error wrong-number-of-arguments (funcall compiled-function 3)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
114 (Assert (eq char-table (get-char-table ?\u0080 char-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
115 "checking basic recursive char table read properly") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
116 (Assert (eq hash-table (gethash 'c hash-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
117 "checking basic recursive hash table read properly") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
118 (Assert (eq range-table (get-range-table #x180 range-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
119 "checking basic recursive range table read properly") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
120 (setf (gethash 'g hash-table) cons |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
121 (car cons) hash-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
122 deserialized-hash-table (read (prin1-to-string hash-table))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
123 (Assert (not (eq deserialized-hash-table hash-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
124 "checking printing and reading hash-table creates a new object") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
125 (Assert (eq deserialized-hash-table (gethash 'c deserialized-hash-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
126 "checking the lisp reader handles deserialized hash-table identity") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
127 (Assert (eq deserialized-hash-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
128 (car (gethash 'g deserialized-hash-table))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
129 "checking the reader handles deserialization identity, hash-table") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
130 (setf (get-char-table ?a char-table) cons |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
131 (car cons) char-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
132 deserialized-char-table (read (prin1-to-string char-table))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
133 (Assert (not (eq deserialized-char-table char-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
134 "checking printing and reading creates a new object") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
135 (Assert (eq deserialized-char-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
136 (get-char-table ?\u0080 deserialized-char-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
137 "checking the lisp reader handles deserialization identity") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
138 (Assert (eq deserialized-char-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
139 (car (get-char-table ?a deserialized-char-table))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
140 "checking the lisp reader handles deserialization identity, mixed") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
141 (put-range-table #x1000 #x1010 cons range-table) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
142 (setf (car cons) range-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
143 deserialized-range-table (read (prin1-to-string range-table))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
144 (Assert (not (eq deserialized-range-table range-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
145 "checking printing and reading creates a new object") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
146 (Assert (eq deserialized-range-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
147 (get-range-table #x101 deserialized-range-table)) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
148 "checking the lisp reader handles deserialization identity") |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
149 (Assert (eq deserialized-range-table |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
150 (car (get-range-table #x1001 deserialized-range-table))) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
151 "checking the lisp reader handles deserialization identity, mixed")) |
|
58b38d5b32d0
Implement print-circle, allowing recursive and circular structures to be read.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5489
diff
changeset
|
152 |
