test-defsystem-depends-on.script 2.05 KB
Newer Older
1 2
;;-*- Lisp -*-

3 4
(in-package :asdf-test)

5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
(def-test-system test-defsystem-depends-on-1
  :defsystem-depends-on (test-asdf/l-file)
  :default-component-class "l-file:cl-source-file.l"
  :components
  ((:cl-source-file.l "file1" :type "lisp")
   (:cl-source-file "file2" :depends-on ("file1"))
   (:file "test-extension")))

(load-system :test-defsystem-depends-on-1)

(def-test-system test-defsystem-depends-on-2
  :defsystem-depends-on (test-asdf/l-operation)
  :build-operation "l-operation:op"
  :components
  ((:file "file3")))

(assert-equal 0 l-operation:*x*)

23
(reset-session)
24
(make :test-defsystem-depends-on-2)
25 26 27 28 29 30 31 32

(assert-equal 2 l-operation:*x*) ;; perform called twice, on file and on system.

(def-test-system test-defsystem-depends-on-3
  :defsystem-depends-on (test-asdf/l-operation)
  :build-operation "does-not-exist"
  :components ((:file "file3")))

33
(reset-session)
34 35
(signals asdf::formatted-system-definition-error
         (handler-bind ((system-out-of-date 'continue)) (make :test-defsystem-depends-on-3)))
36 37 38

(defparameter *newsym* (gentemp (symbol-name 'feature) :keyword))

39
(reset-session)
40 41 42
;;; FIXME: the following form triggers bug https://bugs.launchpad.net/asdf/+bug/1445638
(eval `(def-test-system test-defsystem-depends-on-4
         :defsystem-depends-on ((:feature ,*newsym* "test-defsystem-depends-on-3"))))
43 44

(assert (find-system "test-defsystem-depends-on-4"))
45 46

(progn
47
  (reset-session)
48 49
  (signals missing-dependency (def-test-system unloadable-system
                                  :defsystem-depends-on (nonexistent-system)))
50
  (assert (not (registered-system "unloadable-system"))))
51 52

(progn
53 54
  (signals missing-dependency
           (handler-bind ((system-out-of-date 'continue)) (find-system "test-defsystem-depends-on-missing-system")))
55
  (assert (not (asdf::registered-system "test-defsystem-depends-on-missing-system"))))
56 57

(progn
58 59
  (signals asdf::system-definition-error
           (handler-bind ((system-out-of-date 'continue)) (find-system "test-defsystem-depends-on-circular")))
60
  (assert (not (asdf::registered-system "test-defsystem-depends-on-circular"))))