X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fload.impure.lisp;h=a739006c52849f2c4176f29d2b9edf0b9902a314;hb=171fde84561e232b8af8c05b82dfe8a8f9e08340;hp=461c2383382faaabbb5527f990d55bc2cf7d0ce4;hpb=435658ed85eeb9b7aa3a409464e54ee0763c6ba1;p=sbcl.git diff --git a/tests/load.impure.lisp b/tests/load.impure.lisp index 461c238..a739006 100644 --- a/tests/load.impure.lisp +++ b/tests/load.impure.lisp @@ -271,3 +271,37 @@ (when (find-restart 'sb-fasl::object) (invoke-restart 'sb-fasl::object))))) (load-and-assert spec fasl fasl)))) + +(with-test (:name :bug-332) + (flet ((stimulate-sbcl () + (let ((filename (format nil "/tmp/~A.lisp" (gensym)))) + ;; create a file which redefines a structure incompatibly + (with-open-file (f filename :direction :output :if-exists :supersede) + (print '(defstruct bug-332 foo) f) + (print '(defstruct bug-332 foo bar) f)) + ;; compile and load the file, then invoke the continue restart on + ;; the structure redefinition error + (handler-bind ((error (lambda (c) (continue c)))) + (load (compile-file filename)))))) + (stimulate-sbcl) + (stimulate-sbcl) + (stimulate-sbcl))) + +(defun load-empty-file (type) + (let ((pathname (make-pathname :name "load-impure-lisp-empty-temp" + :type type))) + (unwind-protect + (progn + (with-open-file (f pathname + :if-exists :supersede + :direction :output)) + (handler-case + (progn (load pathname) t) + (error () nil))) + (ignore-errors (delete-file pathname))))) + +(with-test (:name (load "empty.lisp")) + (assert (load-empty-file "lisp"))) + +(with-test (:name (load "empty.fasl")) + (assert (not (load-empty-file "fasl"))))