test-version.script 2.09 KB
Newer Older
1
;;; -*- Lisp -*-
2

3 4 5 6 7 8 9 10 11 12 13 14 15
(DBG "Check that there is an ASDF version that correctly parses to a non-empty list")
(assert (consp (parse-version (asdf-version) 'error)))
(DBG "Check that ASDF is newer than 1.234")
(assert-compare (version<= "1.234" (asdf-version)))
(DBG "Check that ASDF is not a compatible replacement for 1.234")
(assert (not (version-compatible-p (asdf-version) "1.234")))

(DBG "Check that asdf.asd is not registered and we're using a fallback system")
(defparameter *asdf* (find-system :asdf))
(assert-equal nil (system-source-directory *asdf*))
(DBG "Check that the fallback system bears the current asdf version")
(assert-equal (asdf-version) (component-version *asdf*))

16 17 18
(def-test-system :unversioned-system
  :pathname #.*test-directory*)

19 20 21
(def-test-system :versioned-system-1
  :pathname #.*test-directory*
  :version "1.0")
22

23 24 25
(def-test-system :versioned-system-2
  :pathname #.*test-directory*
  :version "1.1")
26

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

32
(def-test-system :versioned-system-file-form
33
  :defsystem-depends-on ((:version :test-asdf/2 "2.1"))
34 35 36 37
  :pathname #.*test-directory*
  :version (:read-file-form "version.lisp-expr" :at 0))

(def-test-system :versioned-system-file-line
38
  :defsystem-depends-on ((:version :test-asdf/2 "2.1"))
39
  :pathname #.*test-directory*
40
  :version (:read-file-line #.(test-source "version.lisp-expr") :at 1))
41

42 43 44
(defun vtest (name v &optional (true t))
  (or (eq true (version-satisfies (find-system name) v))
      (error "no satisfaction: ~S version ~A not ~A" name v true)))
45

46 47 48
(vtest :versioned-system-1 "1.0")
(vtest :versioned-system-2 "1.0")
(vtest :versioned-system-3 "2.0" nil)
49 50
(vtest :versioned-system-file-form "1.0")
(vtest :versioned-system-file-line "1.0")
51 52 53 54 55 56 57 58 59 60
;; version UNmatching
(vtest :unversioned-system "1" nil)
(vtest :versioned-system-1 "1.1" nil)
(vtest :versioned-system-2 "1.1" t)
(vtest :versioned-system-2 "1.1.1" nil)
(vtest :versioned-system-2 "1.2" nil)
(vtest :versioned-system-3 "1.2")
(vtest :versioned-system-3 "1.1")
(vtest :versioned-system-3 "1.1.1")