list-all-packages.lsp 1.19 KB
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Feb 21 17:47:37 2004
;;;; Contains: Tests of LIST-ALL-PACKAGES

6

7 8 9 10 11 12 13 14 15 16 17 18
(declaim (optimize (safety 3)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; list-all-packages

;; list-all-packages returns a list
(deftest list-all-packages.1
  (numberp (ignore-errors (list-length (list-all-packages))))
  t)

;; The required packages are present
(deftest list-all-packages.2
19 20 21 22 23
  (progn
    (set-up-packages)
    (notnot
     (subsetp
      (list (find-package "CL")
sds's avatar
sds committed
24 25 26 27 28 29
            (find-package "CL-USER")
            (find-package "KEYWORD")
            (find-package "A")
            (find-package "REGRESSION-TEST")
            (find-package "CL-TEST")
            (find-package "B"))
30
      (list-all-packages))))
31 32 33 34 35 36 37 38 39 40
  t)

;; The list returned has only packages in it
(deftest list-all-packages.3
  (notnot-mv (every #'packagep (list-all-packages)))
  t)

;; It returns a list of the same packages each time it is called
(deftest list-all-packages.4
  (let ((p1 (list-all-packages))
sds's avatar
sds committed
41
        (p2 (list-all-packages)))
42
    (and (subsetp p1 p2)
sds's avatar
sds committed
43
         (subsetp p2 p1)))
44 45 46 47 48
  t)

(deftest list-all-packages.error.1
  (signals-error (list-all-packages nil) program-error)
  t)