Skip to content
test-xach-update-bug.script 1.23 KiB
Newer Older
;;; -*- Lisp -*-
(load "script-support.lisp")
(load-asdf)

#+gcl (trace load compile-file asdf:perform asdf::perform-plan)
  (let ((foo :test-asdf-location-change))
    (DBG "load foo. Should load from xach-foo-1/")
    (setf *central-registry* (list (subpathname *test-directory* "xach-foo-1/")))
    (load-system foo)
    (let ((foo1 (find-system foo))
          (loaded (find-symbol* :loaded :first-version)))
      (assert-equal (symbol-value loaded) t)
      (DBG "load foo again. Should not do anything -- already loaded")
      (setf (symbol-value loaded) :test-that-we-dont-reload)
      (load-system foo)
      (assert-equal (symbol-value loaded) :test-that-we-dont-reload)

      (assert (not (find-package :second-version)))
      (DBG "Now, change registry so foo is found from xach-foo-2/")
      (setf *central-registry* (list (subpathname *test-directory* "xach-foo-2/")))
      (DBG "load foo yet again. It should see the pathname has changed and load it anew")
      (load-system foo)
      (let ((foo2 (find-system foo)))
        (assert (eq foo1 foo2)) ;; the object should be the same
        (assert (symbol-value (find-symbol* :loaded :second-version)))
        (assert-equal 42 (symbol-call :second-version :wtf))))))