Mercurial > hg > xemacs-beta
annotate tests/automated/symbol-tests.el @ 4967:0d4c9d0f6a8d
rewrite dynarr code
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-02-03 Ben Wing <ben@xemacs.org>
* device-x.c (x_get_resource_prefix):
* device-x.c (Fx_get_resource):
* device-x.c (Fx_get_resource_prefix):
* device-x.c (Fx_put_resource):
* dialog-msw.c:
* dialog-msw.c (handle_question_dialog_box):
* dired-msw.c (mswindows_sort_files):
* dired-msw.c (mswindows_get_files):
* extents.c (extent_fragment_sort_by_priority):
* extents.c (Fset_extent_parent):
* file-coding.c (coding_reader):
* file-coding.c (coding_writer):
* file-coding.c (gzip_convert):
* frame.c (generate_title_string):
* gutter.c (calculate_gutter_size_from_display_lines):
* indent.c (vmotion_1):
* lread.c (read_bit_vector):
* mule-coding.c (iso2022_decode):
* rangetab.c:
* rangetab.c (Fcopy_range_table):
* rangetab.c (Fget_range_table):
* rangetab.c (unified_range_table_copy_data):
* redisplay-msw.c (mswindows_output_string):
* redisplay-output.c (output_display_line):
* redisplay-output.c (redisplay_move_cursor):
* redisplay-output.c (redisplay_clear_bottom_of_window):
* redisplay-tty.c (tty_output_ichar_dynarr):
* redisplay-tty.c (set_foreground_to):
* redisplay-tty.c (set_background_to):
* redisplay-xlike-inc.c (XLIKE_output_string):
* redisplay.c (redisplay_window_text_width_string):
* redisplay.c (redisplay_text_width_string):
* redisplay.c (create_text_block):
* redisplay.c (SET_CURRENT_MODE_CHARS_PIXSIZE):
* redisplay.c (generate_fstring_runes):
* redisplay.c (regenerate_modeline):
* redisplay.c (ensure_modeline_generated):
* redisplay.c (real_current_modeline_height):
* redisplay.c (create_string_text_block):
* redisplay.c (regenerate_window):
* redisplay.c (REGEN_INC_FIND_START_END):
* redisplay.c (point_visible):
* redisplay.c (redisplay_window):
* redisplay.c (mark_glyph_block_dynarr):
* redisplay.c (line_start_cache_start):
* redisplay.c (start_with_line_at_pixpos):
* redisplay.c (update_line_start_cache):
* redisplay.c (glyph_to_pixel_translation):
* redisplay.c (pixel_to_glyph_translation):
* sysdep.c (qxe_readdir):
* text.c (dfc_convert_to_external_format):
* text.c (dfc_convert_to_internal_format):
* toolbar-common.c (common_output_toolbar_button):
* window.c (window_modeline_height):
* window.c (Fwindow_last_line_visible_height):
* window.c (window_displayed_height):
* window.c (window_scroll):
* window.c (get_current_pixel_pos):
Use Dynarr_begin() in place of Dynarr_atp (foo, 0).
* dynarr.c (Dynarr_realloc):
* dynarr.c (Dynarr_lisp_realloc):
* dynarr.c (Dynarr_resize):
* dynarr.c (Dynarr_insert_many):
* dynarr.c (Dynarr_delete_many):
* dynarr.c (Dynarr_memory_usage):
* dynarr.c (stack_like_malloc):
* dynarr.c (stack_like_free):
* lisp.h:
* lisp.h (DECLARE_DYNARR_LISP_IMP):
* lisp.h (XD_DYNARR_DESC):
* lisp.h (Dynarr_pop):
* gutter.c (output_gutter):
* redisplay-output.c (sync_rune_structs):
* redisplay-output.c (redisplay_output_window):
Redo the dynarr code, add greater checks.
Rename the `len', `largest' and `max' members to `len_',
`largest_' and `max_' to try and catch existing places that might
directly modify these values. Make new accessors Dynarr_largest()
and Dynarr_max() and make them and existing Dynarr_length() be
non-lvalues by adding '+ 0' to them; fix a couple of places in the
redisplay code that tried to modify the length directly by setting
Dynarr_length(). Use the accessors whenever possible even in the
dynarr code itself. The accessors also verify that 0 <= len <=
largest <= max. Rename settor function Dynarr_set_size() to
Dynarr_set_length() and use it more consistently; also create
lower-level Dynarr_set_length_1(). This latter function should be
the only function that directly modifies the `len_' member of a
Dynarr, and in the process makes sure that the `largest' value is
kept correct.
Consistently use ERROR_CHECK_STRUCTURES instead of
ERROR_CHECK_TYPES for error-checking code. Reintroduce the
temporarily disabled verification code on the positions of
Dynarr_at(), Dynarr_atp() and Dynarr_atp_past_end().
Also create Dynarr_resize_if() in place of a repeated
code fragment. Clean up all the functions that modify Dynarrs to
use the new macros and functions and verify the correctness of the
Dynarr both before and after the change.
Note that there are two kinds of verification -- one for accessing
and one for modifying. The difference is that the modify
verification additionally checks to make sure that the Dynarr
isn't locked. (This is used in redisplay to check for problems
with reentrancy.)
* lrecord.h: Move XD_DYNARR_DESC to lisp.h, grouping with the dynarr code.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 03 Feb 2010 20:51:18 -0600 |
parents | 189fb67ca31a |
children | 0f66906b6e37 |
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)) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
66 (Assert-equal (symbol-name interned) name) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
79 (Assert-eq (length (weak-list-list weak-list)) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
80 (if (not reversep) 0 len))) |
1413 | 81 (Assert (not (zerop len))) |
82 (garbage-collect) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
83 (Assert-eq (length (weak-list-list weak-list)) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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)) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
130 (Assert-equal (symbol-name foo) "foo") |
428 | 131 (Assert (symbolp bar)) |
132 (Assert (not (intern-soft bar))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
133 (Assert-equal (symbol-name bar) "bar") |
428 | 134 |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
135 (Assert-eq foo foo2) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
136 (Assert-eq foo2 foo3) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
137 (Assert-eq bar bar2) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
167 (Assert-eq foo bar) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
168 (Assert-eq foo 1) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
176 (Assert-eq foo 0) |
428 | 177 (defvaralias 'bar nil) |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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. | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
190 (Assert-eq (read ":foo") (intern ":foo")) |
428 | 191 |
192 ;; A keyword is self-quoting and evaluates to itself. | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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): | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
239 (Assert-eq (set (intern ":foo" [0]) 5) 5) |
428 | 240 |
241 ;;; Printing keywords | |
242 | |
243 (let ((print-gensym t)) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
244 (Assert-equal (prin1-to-string :foo) ":foo") |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
245 (Assert-equal (prin1-to-string (intern ":foo")) ":foo") |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
246 (Assert-equal (prin1-to-string (intern ":foo" [0])) "#::foo")) |
428 | 247 |
248 (let ((print-gensym nil)) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
249 (Assert-equal (prin1-to-string :foo) ":foo") |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
250 (Assert-equal (prin1-to-string (intern ":foo")) ":foo") |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
273 (Assert-equal (catch 'test-tag |
428 | 274 (set mysym 'foo)) |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
282 (Assert-equal save '(foo)) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
293 (Assert-equal (catch 'test-tag |
440 | 294 (makunbound mysym)) |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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)) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
303 (Assert-eq (symbol-value mysym) 'bar) |
440 | 304 (makunbound mysym) |
305 (Assert (not (boundp mysym))) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
306 (Assert-eq save 'makunbound) |
440 | 307 ) |
308 | |
826 | 309 ;; pathname-coding-system is no more. |
310 ; (when (featurep 'file-coding) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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)) | |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
314 ; (Assert-eq val1 val2) |
826 | 315 ; (let ((file-name-coding-system 'no-conversion-dos)) |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
316 ; (Assert-eq file-name-coding-system 'no-conversion-dos) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
317 ; (Assert-eq pathname-coding-system file-name-coding-system)) |
826 | 318 ; (let ((pathname-coding-system 'no-conversion-mac)) |
4855
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
319 ; (Assert-eq file-name-coding-system 'no-conversion-mac) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
320 ; (Assert-eq pathname-coding-system file-name-coding-system)) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
321 ; (Assert-eq file-name-coding-system pathname-coding-system) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
diff
changeset
|
322 ; (Assert-eq val1 file-name-coding-system)) |
189fb67ca31a
Create Assert-eq, Assert-equal, etc.
Ben Wing <ben@xemacs.org>
parents:
4381
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 |