;;-*- Lisp -*-

(register-directory (subpathname *test-directory* "package-inferred-system-test/"))
(load-system :package-inferred-system-test/a/x)
(load-system :package-inferred-system-test/d)

(signals package-inferred-system-missing-package-error (load-system :package-inferred-system-test/e))

;; No such file.
(signals missing-component
         (handler-bind ((system-out-of-date 'continue)) (load-system :package-inferred-system-test/f)))

;; Test that around-compile is inherited by inferred systems.
(assert-equal 3 (symbol-call :package-inferred-system-test/a :add10 1)) ;; add10 must have been compiled in base 2

;; Test that primary system name returns the correct value when called with a
;; package-inferred-system object.
(assert-equal "package-inferred-system-test" (primary-system-name (find-system :package-inferred-system-test/a/x)))

;; Test that :local-nicknames are recognized on relevant implementations
;; NB: requires ABCL >= ? (old 1.5.0 works), CCL >= 1.12 (unreleased as of Dec 2019),
;; CLASP >= ??? (no less released than anything else?), ECL >= 1.6.4 (unreleased as of Dec 2019),
;; SBCL >= ? (old 1.5.0 works)
#+package-local-nicknames
(progn
  (load-system :package-inferred-system-test/local-nicknames-1)
  (assert-equal "g" (symbol-call :package-inferred-system-test/local-nicknames-1 :f)))
