Fix (make-array integer :adjustable t :fill-pointer unknown).
[sbcl.git] / tests / smoke.impure.lisp
blobe723043407a581d917fa2594706d817be9e14867
1 ;;;; rudimentary tests ("smoke tests") for miscellaneous stuff which
2 ;;;; doesn't seem to deserve specialized files at the moment
4 ;;;; This software is part of the SBCL system. See the README file for
5 ;;;; more information.
6 ;;;;
7 ;;;; While most of SBCL is derived from the CMU CL system, the test
8 ;;;; files (like this one) were written from scratch after the fork
9 ;;;; from CMU CL.
10 ;;;;
11 ;;;; This software is in the public domain and is provided with
12 ;;;; absolutely no warranty. See the COPYING and CREDITS files for
13 ;;;; more information.
15 (cl:in-package :cl-user)
17 ;;; ROOM should run without signalling an error. (bug 247)
18 (room)
19 (room t)
20 (room nil)
22 ;;; COPY-SYMBOL should work without signalling an error, even if the
23 ;;; symbol is unbound.
24 (copy-symbol 'foo)
25 (copy-symbol 'bar t)
26 (defvar *baz* nil)
27 (copy-symbol '*baz* t)
29 ;;; SETQ should return its value.
30 (assert (typep (setq *baz* 1) 'integer))
31 (assert (typep (in-package :cl-user) 'package))
33 ;;; PROFILE should run without obvious breakage
34 (progn
35 (defun profiled-fun ()
36 (random 1d0))
37 (profile profiled-fun)
38 (loop repeat 100000 do (profiled-fun))
39 (report))
41 ;;; Defconstant should behave as the documentation specifies,
42 ;;; including documented condition type.
43 (defun oidentity (x) x)
44 (defconstant +const+ 1)
45 (assert (= (oidentity +const+) 1))
46 (let ((error (nth-value 1 (ignore-errors (defconstant +const+ 2)))))
47 (assert (typep error 'sb-ext:defconstant-uneql))
48 (assert (= (sb-ext:defconstant-uneql-old-value error) 1))
49 (assert (= (sb-ext:defconstant-uneql-new-value error) 2))
50 (assert (eql (sb-ext:defconstant-uneql-name error) '+const+)))
51 (assert (= (oidentity +const+) 1))
52 (handler-bind
53 ((sb-ext:defconstant-uneql
54 (lambda (c) (abort c))))
55 (defconstant +const+ 3))
56 (assert (= (oidentity +const+) 1))
57 (handler-bind
58 ((sb-ext:defconstant-uneql
59 (lambda (c) (continue c))))
60 (defconstant +const+ 3))
61 (assert (= (oidentity +const+) 3))
63 ;;; MULTIPLE-VALUE-BIND and lambda list keywords
64 (multiple-value-bind (&rest &optional &key &allow-other-keys)
65 (values 1 2 3)
66 (assert (= &rest 1))
67 (assert (= &optional 2))
68 (assert (= &key 3))
69 (assert (null &allow-other-keys)))
71 (with-test (:name (:lambda-list :suspicious-variables))
72 (multiple-value-bind (fun failure-p warnings style-warnings)
73 (checked-compile `(lambda (&foo &rest &bar) (cons &foo &bar))
74 :allow-style-warnings t)
75 (declare (ignore failure-p warnings))
76 (assert (= 2 (length style-warnings)))
77 (assert (equal (funcall fun 1) '(1)))
78 (assert (equal (funcall fun 1 2 3) '(1 2 3)))))
80 ;;; Failure to save a core is an error
81 (with-test (:name :save-lisp-and-die-error)
82 (assert (eq :oops
83 (handler-case (save-lisp-and-die "/")
84 (error () :oops)))))
86 ;;; success