source: trunk/source/tests/ansi-tests/constantly.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 840 bytes
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Oct  6 19:47:16 2002
4;;;; Contains: Tests for CONSTANTLY
5
6(in-package :cl-test)
7
8(deftest constantly.1
9  (let ((fn (cl:constantly 10))
10        (x nil))
11    (loop for i from 0 to (min 256 (1- call-arguments-limit))
12          always (prog1 (eql (apply fn x) 10)
13                   (push 'a x))))
14  t)
15
16(deftest constantly.2
17  (notnot-mv (cl:constantly 1))
18  t)
19
20(deftest constantly.3
21  (let ((i 0))
22    (let ((fn (cl:constantly (progn (incf i) 'a))))
23      (values
24       i
25       (mapcar fn '(1 2 3 4))
26       i)))
27  1 (a a a a) 1)
28
29(deftest constantly.error.1
30  (signals-error (cl:constantly) program-error)
31  t)
32
33;;; The next test fails in CMUCL, which has non-conformantly extended
34;;; the syntax of constantly.
35(deftest constantly.error.2
36  (signals-error (cl:constantly 1 1) program-error)
37  t)
Note: See TracBrowser for help on using the repository browser.