X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fsmoke.impure.lisp;h=f0069a713c051fa1b376fd78780ac93fba6d0c0a;hb=a189a69454ef7635149319ae213b337f17c50d20;hp=b155ff77b68a9047e9d708b3d3a592c7452c0885;hpb=2fb7ed1815097a415d80e133c9b91ceb74bf5eda;p=sbcl.git diff --git a/tests/smoke.impure.lisp b/tests/smoke.impure.lisp index b155ff7..f0069a7 100644 --- a/tests/smoke.impure.lisp +++ b/tests/smoke.impure.lisp @@ -7,7 +7,7 @@ ;;;; While most of SBCL is derived from the CMU CL system, the test ;;;; files (like this one) were written from scratch after the fork ;;;; from CMU CL. -;;;; +;;;; ;;;; This software is in the public domain and is provided with ;;;; absolutely no warranty. See the COPYING and CREDITS files for ;;;; more information. @@ -19,16 +19,6 @@ (room t) (room nil) -;;; DESCRIBE should run without signalling an error. -(defstruct to-be-described a b) -(describe (make-to-be-described)) -(describe 12) -(describe "a string") -(describe 'symbolism) -(describe (find-package :cl)) -(describe '(a list)) -(describe #(a vector)) - ;;; COPY-SYMBOL should work without signalling an error, even if the ;;; symbol is unbound. (copy-symbol 'foo) @@ -41,11 +31,51 @@ (assert (typep (in-package :cl-user) 'package)) ;;; PROFILE should run without obvious breakage -(defun profiled-fun () - (random 1d0)) -(profile profiled-fun) -(loop repeat 100000 do (profiled-fun)) -(report) +(progn + (defun profiled-fun () + (random 1d0)) + (profile profiled-fun) + (loop repeat 100000 do (profiled-fun)) + (report)) + +;;; Defconstant should behave as the documentation specifies, +;;; including documented condition type. +(defun oidentity (x) x) +(defconstant +const+ 1) +(assert (= (oidentity +const+) 1)) +(let ((error (nth-value 1 (ignore-errors (defconstant +const+ 2))))) + (assert (typep error 'sb-ext:defconstant-uneql)) + (assert (= (sb-ext:defconstant-uneql-old-value error) 1)) + (assert (= (sb-ext:defconstant-uneql-new-value error) 2)) + (assert (eql (sb-ext:defconstant-uneql-name error) '+const+))) +(assert (= (oidentity +const+) 1)) +(handler-bind + ((sb-ext:defconstant-uneql + (lambda (c) (abort c)))) + (defconstant +const+ 3)) +(assert (= (oidentity +const+) 1)) +(handler-bind + ((sb-ext:defconstant-uneql + (lambda (c) (continue c)))) + (defconstant +const+ 3)) +(assert (= (oidentity +const+) 3)) + +;;; MULTIPLE-VALUE-BIND and lambda list keywords +(multiple-value-bind (&rest &optional &key &allow-other-keys) + (values 1 2 3) + (assert (= &rest 1)) + (assert (= &optional 2)) + (assert (= &key 3)) + (assert (null &allow-other-keys))) + +(let ((fn (lambda (&foo &rest &bar) (cons &foo &bar)))) + (assert (equal (funcall fn 1) '(1))) + (assert (equal (funcall fn 1 2 3) '(1 2 3)))) + +;;; Failure to save a core is an error +(with-test (:name :save-lisp-and-die-error) + (assert (eq :oops + (handler-case (save-lisp-and-die "/") + (error () :oops))))) ;;; success -(quit :unix-status 104)