test-retry-loading-component-1.script 1.19 KB
Newer Older
1 2
;;; -*- Lisp -*-

3 4
;; NB: this test does some evil side-effects in the test source directory itself. UGH!

5 6
;;; test asdf:try-recompiling restart

7
(defvar *caught-error* nil)
8
(delete-file-if-exists (test-source "try-reloading-dependency.asd"))
9
(with-asdf-session (:override t)
10 11 12
(handler-bind
    ((error #'(lambda (c)
                (format t "~&Caught error ~s" c)
13 14
                (assert (not *caught-error*) ()
                        "The missing system component error is not fixed by the handler, as expected.")
15
                (setf *caught-error* t)
16 17 18
                ;; Evil side-effect: create a .asd file from .hidden file.
                (concatenate-files (list (test-source "try-reloading-dependency.hidden"))
                                   (test-source "try-reloading-dependency.asd"))
19 20 21 22 23 24 25
                (DBG "trlc1 5")
                (multiple-value-bind (name mode) (find-symbol* :retry :asdf)
                  (assert (eq mode :external) () "Mode of ~s was not external" name)
                  (let ((restart (find-restart name c)))
                    (assert restart)
                    (when restart (invoke-restart restart)))))))
  (load-system 'try-reloading-1))
26
(assert *caught-error*))