modules.lsp 2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Apr 30 19:51:06 2005
;;;; Contains: Tests of *MODULES*, PROVIDE, and REQUIRE

(in-package :cl-test)

(deftest modules.1
  (notnot (every #'stringp *modules*))
  t)

(deftest modules.2
  (let ((*modules* *modules*))
    (provide "FOO")
    (notnot (member "FOO" *modules* :test #'string=)))
  t)

(deftest modules.3
  (let ((*modules* *modules*))
    (provide "FOO")
    (provide "FOO")
    (count "FOO" *modules* :test #'string=))
  1)

(deftest modules.4
  (let ((*modules* *modules*))
    (provide "FOO")
    (require "FOO")
    (values)))

(deftest modules.5
  (let ((*modules* *modules*))
    (provide :|FOO|)
    (notnot (member "FOO" *modules* :test #'string=)))
  t)

(deftest modules.6
  (let ((*modules* *modules*))
    (provide "FOO")
    (require :|FOO|)
    (values)))

(deftest modules.7
  (let ((*modules* *modules*)
sds's avatar
sds committed
45
        (fn 'modules7-fun))
46 47 48 49 50 51 52
    (when (fboundp fn) (fmakunbound fn))
    (require "MODULES-7" #p"modules7.lsp")
    (funcall fn))
  :good)

(deftest modules.8
  (let ((*modules* *modules*)
sds's avatar
sds committed
53
        (fns '(modules8a-fun modules8b-fun)))
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    (dolist (fn fns)
      (when (fboundp fn) (fmakunbound fn)))
    (require "MODULES-8" '(#p"modules8a.lsp" #p"modules8b.lsp"))
    (mapcar #'funcall fns))
  (:good :also-good))

(deftest modules.9
  (signals-error (require "AB7djaCgaaL") error)
  t)

(deftest modules.10
  (do-special-strings
   (s "FOO")
   (let ((*modules* *modules*))
     (provide s)
     (assert (member "FOO" *modules* :test #'string=))))
  nil)

(deftest modules.11
  (do-special-strings
   (s "FOO")
   (let ((*modules* *modules*))
     (provide "FOO")
     (require s)
     (values)))
  nil)

(deftest modules.12
  (unless (member "Z" *modules* :test #'string=)
    (let ((*modules* *modules*))
      (provide #\Z)
      (not (member "Z" *modules* :test #'string=))))
  nil)

(deftest modules.13
  (unless (member "Z" *modules* :test #'string=)
    (let ((*modules* *modules*))
      (provide "Z")
      (require #\Z)
      nil))
sds's avatar
sds committed
94
  nil)