Avoid forward-reference to some simple inline functions.
[sbcl.git] / tests / symbol.pure.lisp
blob1199eac73da6860030351f67d54dbc7985bc0dd7
1 ;;;; miscellaneous tests of SYMBOL-related stuff
3 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; more information.
5 ;;;;
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
8 ;;;; from CMU CL.
9 ;;;;
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 (in-package "CL-USER")
16 ;;; Reported by Paul F. Dietz
17 (with-test (:name (:symbol :non-simple-string-name))
18 (let ((sym (make-symbol (make-array '(1) :element-type 'character
19 :adjustable t :initial-contents "X"))))
20 (assert (simple-string-p (symbol-name sym)))
21 (print sym (make-broadcast-stream))))
23 (with-test (:name (gentemp :pprinter))
24 (let* ((*print-pprint-dispatch* (copy-pprint-dispatch)))
25 (set-pprint-dispatch 'string
26 (lambda (stream obj) (write-string "BAR-" stream)))
27 (assert (string= "FOO-" (gentemp "FOO-") :end2 4))))
29 (with-test (:name (gensym :fixnum-restriction))
30 (gensym (1+ most-positive-fixnum)))
32 ;; lp#1439921
33 ;; CLHS states that SYMBOL-FUNCTION of a symbol naming a special operator
34 ;; or macro must return something implementation-defined that might not
35 ;; be a function. In this implementation it is a function, but it is illegal
36 ;; to assign that function into another symbol via (SETF FDEFINITION).
37 (with-test (:name :setf-fdefinition-no-magic-functions)
38 (assert-error (setf (fdefinition 'mysym) (fdefinition 'and)))
39 (assert-error (setf (fdefinition 'mysym) (fdefinition 'if)))
40 (assert-error (setf (symbol-function 'mysym) (symbol-function 'and)))
41 (assert-error (setf (symbol-function 'mysym) (symbol-function 'if))))