1.0.43.75: pathnames: both Unix and Win32 use UNPARSE-PHYSICAL-DIRECTORY
[sbcl.git] / tests / eval.impure.lisp
index a3db89d..6900d74 100644 (file)
       (tagbody (go NIL) NIL) t)
     (assert (tagbody-nil-is-valid-tag))))
 
+;;; top-level DECLARE is formally undefined, but we want it to raise
+;;; an error rather than silently return NIL.
+(defvar *scratch*)
+(with-test (:name :toplevel-declare)
+  (assert (raises-error? (eval '(declare (type pathname *scratch*))))))
+
+(with-test (:name (eval no-compiler-notes))
+  (handler-bind ((sb-ext:compiler-note #'error))
+    (let ((sb-ext:*evaluator-mode* :compile))
+      (eval '(let ((x 42))
+              (if nil x)))
+      (eval '(let ((* 13))
+              (let ((x 42)
+                    (y *))
+                (declare (optimize speed))
+                (+ x y)))))))
+
+(with-test (:name :bug-238)
+  (let ((sb-ext:*evaluator-mode* :compile))
+    (handler-bind ((sb-ext:compiler-note #'error))
+      (eval '(defclass bug-238 () ()))
+      (eval '(defmethod bug-238 ((x bug-238) (bug-238 bug-238))
+              (call-next-method)))
+      (eval '(handler-case
+              (with-input-from-string (*query-io* "    no")
+                (yes-or-no-p))
+              (simple-type-error () 'error)))
+      t)))
+
+#+sb-eval
+(with-test (:name :bug-524707)
+  (let ((*evaluator-mode* :interpret)
+        (lambda-form '(lambda (x) (declare (fixnum x)) (1+ x))))
+    (let ((fun (eval lambda-form)))
+      (assert (equal lambda-form (function-lambda-expression fun))))))
+
 ;;; success