1 ;;;; miscellaneous tests of symbol properties
3 ;;;; This software is part of the SBCL system. See the README file for
6 ;;;; While most of SBCL is derived from the CMU CL system, the test
7 ;;;; files (like this one) were written from scratch after the fork
10 ;;;; This software is in the public domain and is provided with
11 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
12 ;;;; more information.
14 (defun test-symbol (symbol)
15 (setf (symbol-plist symbol
) nil
)
16 (setf (get symbol
'foo
) '(my list
))
17 (setf (get symbol
'bar
) 10)
18 (setf (get symbol
'baz
) t
)
19 (assert (eql (get symbol
'bar
) 10))
20 (assert (= (length (symbol-plist symbol
)) 6))
22 (assert (not (get symbol
'foo
))))
23 (dolist (s '(foo :keyword || t nil
))
24 (let ((save (symbol-plist s
)))
25 (unwind-protect (test-symbol s
)
26 (setf (symbol-plist s
) save
))))
27 ;;; In early 0.7 versions on non-x86 ports, setting the property list
28 ;;; of 'NIL would trash (CDR NIL), due to a screwup in the low-level
29 ;;; layout of SYMBOL. (There are several low-level punnish tricks used
30 ;;; to make NIL work both as a cons and as a symbol without requiring
31 ;;; a lot of conditional branching at runtime.)
32 (defparameter *nil-that-the-compiler-cannot-constant-fold
* nil
)
33 (assert (not (car *nil-that-the-compiler-cannot-constant-fold
*)))
34 (assert (not (cdr *nil-that-the-compiler-cannot-constant-fold
*)))