Mercurial > hg > xemacs-beta
annotate tests/automated/symbol-tests.el @ 5146:88bd4f3ef8e4
make lrecord UID's have a separate UID space for each object, resurrect debug SOE code in extents.c
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-03-15 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (c_readonly):
* alloc.c (deadbeef_memory):
* alloc.c (make_compiled_function):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (noseeum_make_marker):
* alloc.c (ADDITIONAL_FREE_string):
* alloc.c (common_init_alloc_early):
* alloc.c (init_alloc_once_early):
* bytecode.c (print_compiled_function):
* bytecode.c (mark_compiled_function):
* casetab.c:
* casetab.c (print_case_table):
* console.c:
* console.c (print_console):
* database.c (print_database):
* database.c (finalize_database):
* device-msw.c (sync_printer_with_devmode):
* device-msw.c (print_devmode):
* device-msw.c (finalize_devmode):
* device.c:
* device.c (print_device):
* elhash.c:
* elhash.c (print_hash_table):
* eval.c (print_multiple_value):
* eval.c (mark_multiple_value):
* events.c (deinitialize_event):
* events.c (print_event):
* events.c (event_equal):
* extents.c:
* extents.c (soe_dump):
* extents.c (soe_insert):
* extents.c (soe_delete):
* extents.c (soe_move):
* extents.c (extent_fragment_update):
* extents.c (print_extent_1):
* extents.c (print_extent):
* extents.c (vars_of_extents):
* frame.c:
* frame.c (print_frame):
* free-hook.c:
* free-hook.c (check_free):
* glyphs.c:
* glyphs.c (print_image_instance):
* glyphs.c (print_glyph):
* gui.c:
* gui.c (copy_gui_item):
* hash.c:
* hash.c (NULL_ENTRY):
* hash.c (KEYS_DIFFER_P):
* keymap.c (print_keymap):
* keymap.c (MARKED_SLOT):
* lisp.h:
* lrecord.h:
* lrecord.h (LISP_OBJECT_UID):
* lrecord.h (set_lheader_implementation):
* lrecord.h (struct old_lcrecord_header):
* lstream.c (print_lstream):
* lstream.c (finalize_lstream):
* marker.c (print_marker):
* marker.c (marker_equal):
* mc-alloc.c (visit_all_used_page_headers):
* mule-charset.c:
* mule-charset.c (print_charset):
* objects.c (print_color_instance):
* objects.c (print_font_instance):
* objects.c (finalize_font_instance):
* opaque.c (print_opaque):
* opaque.c (print_opaque_ptr):
* opaque.c (equal_opaque_ptr):
* print.c (internal_object_printer):
* print.c (enum printing_badness):
* rangetab.c (print_range_table):
* rangetab.c (range_table_equal):
* specifier.c (print_specifier):
* specifier.c (finalize_specifier):
* symbols.c:
* symbols.c (print_symbol_value_magic):
* tooltalk.c:
* tooltalk.c (print_tooltalk_message):
* tooltalk.c (print_tooltalk_pattern):
* window.c (print_window):
* window.c (debug_print_window):
(1) Make lrecord UID's have a separate UID space for each object.
Otherwise, with 20-bit UID's, we rapidly wrap around, especially
when common objects like conses and strings increment the UID value
for every object created. (Originally I tried making two UID spaces,
one for objects that always print readably and hence don't display
the UID, and one for other objects. But certain objects like markers
for which a UID is displayed are still generated rapidly enough that
UID overflow is a serious issue.) This also has the advantage of
making UID values smaller, hence easier to remember -- their main
purpose is to make it easier to keep track of different objects of
the same type when debugging code. Make sure we dump lrecord UID's
so that we don't have problems with pdumped and non-dumped objects
having the same UID.
(2) Display UID's consistently whenever an object (a) doesn't
consistently print readably (objects like cons and string, which
always print readably, can't display a UID), and (b) doesn't
otherwise have a unique property that makes objects of a
particular type distinguishable. (E.g. buffers didn't and still
don't print an ID, but the buffer name uniquely identifies the
buffer.) Some types, such as event, extent, compiled-function,
didn't always (or didn't ever) display an ID; others (such as
marker, extent, lstream, opaque, opaque-ptr, any object using
internal_object_printer()) used to display the actual machine
pointer instead.
(3) Rename NORMAL_LISP_OBJECT_UID to LISP_OBJECT_UID; make it work
over all Lisp objects and take a Lisp object, not a struct pointer.
(4) Some misc cleanups in alloc.c, elhash.c.
(5) Change code in events.c that "deinitializes" an event so that
it doesn't increment the event UID counter in the process. Also
use deadbeef_memory() to overwrite memory instead of doing the same
with custom code. In the process, make deadbeef_memory() in
alloc.c always available, and delete extraneous copy in mc-alloc.c.
Also capitalize all uses of 0xDEADBEEF. Similarly in elhash.c
call deadbeef_memory().
(6) Resurrect "debug SOE" code in extents.c. Make it conditional
on DEBUG_XEMACS and on a `debug-soe' variable, rather than on
SOE_DEBUG. Make it output to stderr, not stdout.
(7) Delete some custom print methods that were identical to
external_object_printer().
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Mon, 15 Mar 2010 16:35:38 -0500 |
parents | 0f66906b6e37 |
children | 308d34e9f07d |
rev | line source |
---|---|
428 | 1 ;; Copyright (C) 1999 Free Software Foundation, Inc. |
2 | |
3 ;; Author: Hrvoje Niksic <hniksic@xemacs.org> | |
4 ;; Maintainer: Hrvoje Niksic <hniksic@xemacs.org> | |
5 ;; Created: 1999 | |
6 ;; Keywords: tests | |
7 | |
8 ;; This file is part of XEmacs. | |
9 | |
10 ;; XEmacs is free software; you can redistribute it and/or modify it | |
11 ;; under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; XEmacs is distributed in the hope that it will be useful, but | |
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 ;; General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
23 ;; 02111-1307, USA. | |
24 | |
25 ;;; Synched up with: Not in FSF. | |
26 | |
27 ;;; Commentary: | |
28 | |
29 ;; Test symbols operations. | |
30 ;; See test-harness.el for instructions on how to run these tests. | |
31 | |
32 (eval-when-compile | |
33 (condition-case nil | |
34 (require 'test-harness) | |
35 (file-error | |
36 (push "." load-path) | |
37 (when (and (boundp 'load-file-name) (stringp load-file-name)) | |
38 (push (file-name-directory load-file-name) load-path)) | |
39 (require 'test-harness)))) | |
40 | |
41 | |
42 (defun ts-fresh-symbol-name (name) | |
43 "Return a variant of NAME (a string) that is not interned." | |
44 (when (intern-soft name) | |
45 (let ((count 1) | |
46 (orig name)) | |
47 (while (progn | |
48 (setq name (format "%s-%d" orig count)) | |
49 (intern-soft name)) | |
50 (incf count)))) | |
51 name) | |
52 | |
53 ;;----------------------------------------------------- | |
54 ;; Creating, reading, and printing symbols | |
55 ;;----------------------------------------------------- | |
56 | |
57 (dolist (name '("foo" "bar" "" | |
58 "something with space in it" | |
59 "a string with \0 in the middle." | |
60 "100" "10.0" "#<>[]]]];'\\';" | |
61 "!@#$%^^&*(()__")) | |
62 (let ((interned (intern name)) | |
63 (uninterned (make-symbol name))) | |
64 (Assert (symbolp interned)) | |
65 (Assert (symbolp uninterned)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
66 (Assert (equal (symbol-name interned) name)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
67 (Assert (equal (symbol-name uninterned) name)) |
428 | 68 (Assert (not (eq interned uninterned))) |
69 (Assert (not (equal interned uninterned))))) | |
70 | |
71 (flet ((check-weak-list-unique (weak-list &optional reversep) | |
72 "Check that elements of WEAK-LIST are referenced only there." | |
73 (let ((len (length (weak-list-list weak-list)))) | |
1413 | 74 (if (string-match "Using the new GC algorithms." |
75 Installation-string) | |
76 (Implementation-Incomplete-Expect-Failure | |
77 (Assert (not (zerop len))) | |
78 (garbage-collect) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
79 (Assert (eq (length (weak-list-list weak-list)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
80 (if (not reversep) 0 len)))) |
1413 | 81 (Assert (not (zerop len))) |
82 (garbage-collect) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
83 (Assert (eq (length (weak-list-list weak-list)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
84 (if (not reversep) 0 len))))))) |
428 | 85 (let ((weak-list (make-weak-list)) |
86 (gc-cons-threshold most-positive-fixnum)) | |
87 ;; Symbols created with `make-symbol' and `gensym' should be fresh | |
88 ;; and not referenced anywhere else. We check that no other | |
89 ;; references are available using a weak list. | |
90 (eval | |
91 ;; This statement must not be run byte-compiled, or the values | |
92 ;; remain referenced on the bytecode interpreter stack. | |
93 '(set-weak-list-list weak-list (list (make-symbol "foo") (gensym "foo")))) | |
94 (check-weak-list-unique weak-list) | |
95 | |
96 ;; Equivalent test for `intern' and `gentemp'. | |
97 (eval | |
98 '(set-weak-list-list weak-list | |
99 (list (intern (ts-fresh-symbol-name "foo")) | |
100 (gentemp (ts-fresh-symbol-name "bar"))))) | |
101 (check-weak-list-unique weak-list 'not))) | |
102 | |
103 (Assert (not (intern-soft (make-symbol "foo")))) | |
104 (Assert (not (intern-soft (gensym "foo")))) | |
105 (Assert (intern-soft (intern (ts-fresh-symbol-name "foo")))) | |
106 (Assert (intern-soft (gentemp (ts-fresh-symbol-name "bar")))) | |
107 | |
108 ;; Reading a symbol should intern it automatically, unless the symbol | |
109 ;; is marked specially. | |
110 (dolist (string (mapcar #'ts-fresh-symbol-name '("foo" "bar" "\\\0\\\1"))) | |
111 (setq symbol (read string) | |
112 string (read (concat "\"" string "\""))) | |
113 (Assert (intern-soft string)) | |
114 (Assert (intern-soft symbol)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
115 (Assert (eq (intern-soft string) (intern-soft symbol)))) |
428 | 116 |
117 (let ((fresh (read (concat "#:" (ts-fresh-symbol-name "foo"))))) | |
118 (Assert (not (intern-soft fresh)))) | |
119 | |
120 ;; Check #N=OBJECT and #N# read syntax. | |
121 (let* ((list (read "(#1=#:foo #1# #2=#:bar #2# #1# #2#)")) | |
122 (foo (nth 0 list)) | |
123 (foo2 (nth 1 list)) | |
124 (bar (nth 2 list)) | |
125 (bar2 (nth 3 list)) | |
126 (foo3 (nth 4 list)) | |
127 (bar3 (nth 5 list))) | |
128 (Assert (symbolp foo)) | |
129 (Assert (not (intern-soft foo))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
130 (Assert (equal (symbol-name foo) "foo")) |
428 | 131 (Assert (symbolp bar)) |
132 (Assert (not (intern-soft bar))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
133 (Assert (equal (symbol-name bar) "bar")) |
428 | 134 |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
135 (Assert (eq foo foo2)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
136 (Assert (eq foo2 foo3)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
137 (Assert (eq bar bar2)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
138 (Assert (eq bar2 bar3))) |
428 | 139 |
140 ;; Check #N=OBJECT and #N# print syntax. | |
141 (let* ((foo (make-symbol "foo")) | |
142 (bar (make-symbol "bar")) | |
143 (list (list foo foo bar bar foo bar))) | |
144 (let* ((print-gensym nil) | |
145 (printed-list (prin1-to-string list))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
146 (Assert (equal printed-list "(foo foo bar bar foo bar)"))) |
428 | 147 (let* ((print-gensym t) |
148 (printed-list (prin1-to-string list))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
149 (Assert (equal printed-list "(#1=#:foo #1# #2=#:bar #2# #1# #2#)")))) |
428 | 150 |
151 ;;----------------------------------------------------- | |
152 ;; Read-only symbols | |
153 ;;----------------------------------------------------- | |
154 | |
155 (Check-Error setting-constant | |
156 (set nil nil)) | |
157 (Check-Error setting-constant | |
158 (set t nil)) | |
159 | |
160 ;;----------------------------------------------------- | |
161 ;; Variable indirections | |
162 ;;----------------------------------------------------- | |
163 | |
164 (let ((foo 0) | |
165 (bar 1)) | |
166 (defvaralias 'foo 'bar) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
167 (Assert (eq foo bar)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
168 (Assert (eq foo 1)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
169 (Assert (eq (variable-alias 'foo) 'bar)) |
428 | 170 (defvaralias 'bar 'foo) |
171 (Check-Error cyclic-variable-indirection | |
172 (symbol-value 'foo)) | |
173 (Check-Error cyclic-variable-indirection | |
174 (symbol-value 'bar)) | |
175 (defvaralias 'foo nil) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
176 (Assert (eq foo 0)) |
428 | 177 (defvaralias 'bar nil) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
178 (Assert (eq bar 1))) |
428 | 179 |
180 ;;----------------------------------------------------- | |
181 ;; Keywords | |
182 ;;----------------------------------------------------- | |
183 | |
184 ;;; Reading keywords | |
185 | |
186 ;; In Elisp, a keyword is by definition a symbol beginning with `:' | |
187 ;; that is interned in the global obarray. | |
188 | |
189 ;; In Elisp, a keyword is interned as any other symbol. | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
190 (Assert (eq (read ":foo") (intern ":foo"))) |
428 | 191 |
192 ;; A keyword is self-quoting and evaluates to itself. | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
193 (Assert (eq (eval (intern ":foo")) :foo)) |
428 | 194 |
195 ;; Keywords are recognized as such only if interned in the global | |
196 ;; obarray, and `keywordp' is aware of that. | |
197 (Assert (keywordp :foo)) | |
198 (Assert (not (keywordp (intern ":foo" [0])))) | |
199 | |
200 ;; Keywords used to be initialized at read-time, which resulted in | |
201 ;; (symbol-value (intern ":some-new-keyword")) signaling an error. | |
202 ;; Now we handle keywords at the time when the symbol is interned, so | |
203 ;; that (intern ":something) and (read ":something) will be | |
204 ;; equivalent. These tests check various operations on symbols that | |
205 ;; are guaranteed to be freshly interned. | |
206 | |
207 ;; Interning a fresh keyword string should produce a regular | |
208 ;; keyword. | |
209 (let* ((fresh-keyword-name (ts-fresh-symbol-name ":foo")) | |
210 (fresh-keyword (intern fresh-keyword-name))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
211 (Assert (eq (symbol-value fresh-keyword) fresh-keyword)) |
428 | 212 (Assert (keywordp fresh-keyword))) |
213 | |
214 ;; Likewise, reading a fresh keyword string should produce a regular | |
215 ;; keyword. | |
216 (let* ((fresh-keyword-name (ts-fresh-symbol-name ":foo")) | |
217 (fresh-keyword (read fresh-keyword-name))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
218 (Assert (eq (symbol-value fresh-keyword) fresh-keyword)) |
428 | 219 (Assert (keywordp fresh-keyword))) |
220 | |
221 ;;; Assigning to keywords | |
222 | |
223 ;; You shouldn't be able to set its value to something bogus. | |
224 (Check-Error setting-constant | |
225 (set :foo 5)) | |
226 | |
227 ;; But, for backward compatibility, setting to the same value is OK. | |
228 (Assert | |
229 (eq (set :foo :foo) :foo)) | |
230 | |
231 ;; Playing games with `intern' shouldn't fool us. | |
232 (Check-Error setting-constant | |
233 (set (intern ":foo" obarray) 5)) | |
234 (Assert | |
235 (eq (set (intern ":foo" obarray) :foo) :foo)) | |
236 | |
237 ;; But symbols not interned in the global obarray are not real | |
238 ;; keywords (in elisp): | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
239 (Assert (eq (set (intern ":foo" [0]) 5) 5)) |
428 | 240 |
241 ;;; Printing keywords | |
242 | |
243 (let ((print-gensym t)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
244 (Assert (equal (prin1-to-string :foo) ":foo")) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
245 (Assert (equal (prin1-to-string (intern ":foo")) ":foo")) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
246 (Assert (equal (prin1-to-string (intern ":foo" [0])) "#::foo"))) |
428 | 247 |
248 (let ((print-gensym nil)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
249 (Assert (equal (prin1-to-string :foo) ":foo")) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
250 (Assert (equal (prin1-to-string (intern ":foo")) ":foo")) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
251 (Assert (equal (prin1-to-string (intern ":foo" [0])) ":foo"))) |
428 | 252 |
253 ;; #### Add many more tests for printing and reading symbols, as well | |
254 ;; as print-gensym and print-gensym-alist! | |
255 | |
256 ;;----------------------------------------------------- | |
257 ;; Magic symbols | |
258 ;;----------------------------------------------------- | |
259 | |
440 | 260 ;; Magic symbols are only half implemented. However, a subset of the |
261 ;; functionality is being used to implement backward compatibility or | |
262 ;; clearer error messages for new features such as specifiers and | |
263 ;; glyphs. These tests try to test that working subset. | |
428 | 264 |
440 | 265 (let ((mysym (make-symbol "test-symbol")) |
266 save) | |
428 | 267 (dontusethis-set-symbol-value-handler |
268 mysym | |
269 'set-value | |
270 (lambda (&rest args) | |
271 (throw 'test-tag args))) | |
440 | 272 (Assert (not (boundp mysym))) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
273 (Assert (equal (catch 'test-tag |
428 | 274 (set mysym 'foo)) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
275 `(,mysym (foo) set nil nil))) |
440 | 276 (Assert (not (boundp mysym))) |
277 (dontusethis-set-symbol-value-handler | |
278 mysym | |
279 'set-value | |
280 (lambda (&rest args) (setq save (nth 1 args)))) | |
281 (set mysym 'foo) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
282 (Assert (equal save '(foo))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
283 (Assert (eq (symbol-value mysym) 'foo)) |
440 | 284 ) |
428 | 285 |
440 | 286 (let ((mysym (make-symbol "test-symbol")) |
287 save) | |
288 (dontusethis-set-symbol-value-handler | |
289 mysym | |
290 'make-unbound | |
291 (lambda (&rest args) | |
292 (throw 'test-tag args))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
293 (Assert (equal (catch 'test-tag |
440 | 294 (makunbound mysym)) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
295 `(,mysym nil makunbound nil nil))) |
440 | 296 (dontusethis-set-symbol-value-handler |
297 mysym | |
298 'make-unbound | |
299 (lambda (&rest args) (setq save (nth 2 args)))) | |
300 (Assert (not (boundp mysym))) | |
301 (set mysym 'bar) | |
302 (Assert (null save)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
303 (Assert (eq (symbol-value mysym) 'bar)) |
440 | 304 (makunbound mysym) |
305 (Assert (not (boundp mysym))) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
306 (Assert (eq save 'makunbound)) |
440 | 307 ) |
308 | |
826 | 309 ;; pathname-coding-system is no more. |
310 ; (when (featurep 'file-coding) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
311 ; (Assert (eq pathname-coding-system file-name-coding-system)) |
826 | 312 ; (let ((val1 file-name-coding-system) |
313 ; (val2 pathname-coding-system)) | |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
314 ; (Assert (eq val1 val2)) |
826 | 315 ; (let ((file-name-coding-system 'no-conversion-dos)) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
316 ; (Assert (eq file-name-coding-system 'no-conversion-dos)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
317 ; (Assert (eq pathname-coding-system file-name-coding-system))) |
826 | 318 ; (let ((pathname-coding-system 'no-conversion-mac)) |
5136
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
319 ; (Assert (eq file-name-coding-system 'no-conversion-mac)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
320 ; (Assert (eq pathname-coding-system file-name-coding-system))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
321 ; (Assert (eq file-name-coding-system pathname-coding-system)) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
322 ; (Assert (eq val1 file-name-coding-system))) |
0f66906b6e37
Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents:
4855
diff
changeset
|
323 ; (Assert (eq pathname-coding-system file-name-coding-system))) |
440 | 324 |
428 | 325 |
326 ;(let ((mysym (make-symbol "test-symbol"))) | |
327 ; (dontusethis-set-symbol-value-handler | |
328 ; mysym | |
329 ; 'make-local | |
330 ; (lambda (&rest args) | |
331 ; (throw 'test-tag args))) | |
332 ; (Assert (equal (catch 'test-tag | |
333 ; (set mysym 'foo)) | |
440 | 334 ; `(,mysym (foo) make-local nil nil)))) |
4381
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
335 |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
336 ;; ---------------------------------------------------------------- |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
337 ;; Symbol documentation |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
338 ;; ---------------------------------------------------------------- |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
339 |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
340 ;; built-in variable documentation |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
341 (Assert (string= (built-in-symbol-file 'internal-doc-file-name) |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
342 "doc.c")) |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
343 |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
344 ;; built-in function documentation |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
345 (Assert (string= (built-in-symbol-file 'built-in-symbol-file) |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
346 "doc.c")) |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
347 |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
348 ;; built-in macro documentation |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
349 (Assert (string= (built-in-symbol-file 'when) |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
350 "eval.c")) |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
351 |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
352 ;; #### we should handle symbols defined in Lisp, dumped, autoloaded, |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
353 ;; and required, too. |
3906442b491b
Improve style and add tests for 'built-in-symbol-file'.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
1413
diff
changeset
|
354 |