lambda-list-keywords.lsp 1.19 KB
Newer Older
1 2 3 4 5 6 7 8 9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Oct  7 22:11:31 2002
;;;; Contains: Tests for LAMBDA-LIST-KEYWORDS

(in-package :cl-test)

;;; The variable is bound
(deftest lambda-list-keywords.1
10
  (not-mv (boundp 'lambda-list-keywords))
11 12 13 14
  nil)

;;; The variable is a constant
(deftest lambda-list-keywords.2
15
  (not-mv (constantp 'lambda-list-keywords))
16 17 18 19 20
  nil)

;;; The standard keywords are present in the list
(deftest lambda-list-keywords.3
  (and (consp lambda-list-keywords)
sds's avatar
sds committed
21 22 23 24
       (not-mv (set-difference '(&allow-other-keys
                                 &aux &body &environment
                                 &key &optional &rest &whole)
                               lambda-list-keywords)))
25 26 27
  t)

;;; No lambda list keywords are in the keyword package
28 29 30
;;; (deftest lambda-list-keywords.4
;;;  (some #'keywordp lambda-list-keywords)
;;;  nil)
31 32 33 34

;;; Every keyword starts with an ampersand
(deftest lambda-list-keywords.5
  (notevery #'(lambda (sym)
sds's avatar
sds committed
35 36 37 38 39
                (and (symbolp sym)
                     (let ((name (symbol-name sym)))
                       (and (> (length name) 0)
                            (eql (aref name 0) #\&)))))
            lambda-list-keywords)
40
  nil)