function-lambda-expression.lsp 1.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Mon Jan 13 16:27:12 2003
;;;; Contains: Tests for FUNCTION-LAMBDA-EXPRESSION

(in-package :cl-test)

(deftest function-lambda-expression.1
  (length
   (multiple-value-list
    (function-lambda-expression #'cons)))
  3)

(deftest function-lambda-expression.2
  (let ((x nil))
    (flet ((%f () x))
      (let ((ret-vals
sds's avatar
sds committed
18 19 20 21
             (multiple-value-list
              (function-lambda-expression #'%f))))
        (values (length ret-vals)
                (notnot (second ret-vals))))))
22 23
  3 t)

24 25 26 27 28 29 30 31
;;; Verify that it doesn't barf on generic functions
(deftest function-lambda-expression.3
  (length
   (multiple-value-list
    (function-lambda-expression
     #'meaningless-user-generic-function-for-universe)))
  3)

32 33 34 35 36 37
(deftest function-lambda-expression.order.1
  (let ((i 0))
    (function-lambda-expression (progn (incf i) #'cons))
    i)
  1)

38
(deftest function-lambda-expression.error.1
39 40
  (signals-error (function-lambda-expression) program-error)
  t)
41 42

(deftest function-lambda-expression.error.2
43 44
  (signals-error (function-lambda-expression #'cons nil) program-error)
  t)