test-preloaded.script 1.56 KB
Newer Older
1 2 3 4 5 6 7 8 9
;;; -*- Lisp -*-
(in-package :asdf-test)

(DBG "Consider a system that does not exist. Loading it fails.")
(assert (null (find-system :this-system-does-not-exist nil)))
(errors missing-component (load-system :this-system-does-not-exist))

(DBG "Now let's register it as preloaded. Loading it will work!")
(register-preloaded-system :this-system-does-not-exist :version "3.14")
10 11 12
;; Eagerly registered since 3.1.7.20. See gitlab merge request 13 for the full story.
(assert (system-registered-p :this-system-does-not-exist))
(load-system :this-system-does-not-exist) ;; We can load it indeed, though it's a NOP.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33


(DBG "Now let's load a simple system. It should create a package.")
(load-system :test-asdf/1)
(assert (find-package :test-package))

(DBG "Destroy the package, clear the system and load it again. The package should be back.")
(delete-package :test-package) (clear-system :test-asdf/1)
(load-system :test-asdf/1)
(assert (find-package :test-package))

(DBG "Destroy the package, clear the system, and register it as immutable. Try loading it again.")
(DBG "The package should NOT be back, because it's immutable thus it's NOT going to be loaded.")
(delete-package :test-package) (clear-system :test-asdf/1)
(assert (null (system-registered-p :test-asdf/1))) ;; not registered as loaded
(register-immutable-system :test-asdf/1)
(assert (system-registered-p :test-asdf/1)) ;; now it's registered as loaded
(load-system :test-asdf/1)
(assert (system-registered-p :test-asdf/1)) ;; and it is "loaded" indeed!
(assert (null (find-package :test-package))) ;; but the source code wasn't loaded