test-cache-for-introspection.script 3.02 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
;;; -*- Lisp -*-

;;;---------------------------------------------------------------------------
;;; Test to see that we are correctly caching information about system
;;; definitions
;;;---------------------------------------------------------------------------
(def-test-system test-weakly-depends-on
  :weakly-depends-on (file3-only)
  :components ((:file "file1")))

(def-test-system test-no-weakly-depends-on
  :components ((:file "file1")))

(def-test-system :versioned-system-3
  :defsystem-depends-on ((:version :test-asdf/2 "2.1"))
  :pathname #.*test-directory*
  :version "1.2")

19 20 21 22 23
(def-test-system :versioned-system-4
  :defsystem-depends-on ((:version test-asdf/2 "2.1"))
  :pathname #.*test-directory*
  :version "1.2")

24 25 26 27 28 29 30 31
(def-test-system :test-concatenate-source
  :depends-on (:file3-only)
  :components
  ((:file "file2" :depends-on ("foo"))
   (:module "foo" :pathname ""
    :components ((:file "file1")
                 (:file "file4" :if-feature (:not :common-lisp))))))

32 33 34 35 36 37 38
(def-test-system :test-structured-depends
  :depends-on ((:version test-asdf/2 "2.1") :file3-only (:feature :foo (:require "blort")))
  :components
  ((:file "file2" :depends-on ("foo"))
   (:module "foo" :pathname ""
    :components ((:file "file1")
                 (:file "file4" :if-feature (:not :common-lisp))))))
39 40


41 42 43



44
(DBG "The weakly-depends-on information is properly cached")
45
(assert (equal '("file3-only") (system-weakly-depends-on (find-system "test-weakly-depends-on"))))
46 47 48 49
(assert (null (system-weakly-depends-on (find-system "test-no-weakly-depends-on"))))

(DBG "The depends-on information is properly cached")
(assert (null (system-depends-on (find-system "test-no-weakly-depends-on"))))
50
(assert (equalp '("file3-only") (system-depends-on (find-system "test-concatenate-source"))))
51 52 53

(DBG "The defsystem-depends-on information is properly cached")
(assert (null (system-defsystem-depends-on (find-system "test-no-weakly-depends-on"))))
54 55 56 57 58 59 60
(assert (equalp '((:version "test-asdf/2" "2.1")) (system-defsystem-depends-on (find-system :versioned-system-3))))
(assert (equalp '((:version "test-asdf/2" "2.1")) (system-defsystem-depends-on (find-system :versioned-system-4))))

(DBG "Test structured dependencies")
(assert (equalp
          '((:version "test-asdf/2" "2.1") "file3-only" (:feature :foo (:require "blort")))
          (system-depends-on (find-system :test-structured-depends))))
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75

(DBG "Test removal of non-orthogonal feature syntax.")
(assert (typep
         (catch 'error
          (handler-bind ((system-definition-error
                           #'(lambda (e) 
                               (throw 'error e))))
            (def-test-system :test-structured-depends-with-obsolete-feature-syntax
              :depends-on ((:version test-asdf/2 "2.1") :file3-only (feature :foo (:require "blort")))
              :components
              ((:file "file2" :depends-on ("foo"))
               (:module "foo" :pathname ""
                :components ((:file "file1")
                             (:file "file4" :if-feature (:not :common-lisp))))))))
         'system-definition-error))