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

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

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

File size: 1.6 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Fri Oct 18 19:39:34 2002
4;;;; Contains: Tests of UNLESS
5
6(in-package :cl-test)
7
8(deftest unless.1
9  (unless t)
10  nil)
11
12(deftest unless.2
13  (unless nil)
14  nil)
15
16(deftest unless.3
17  (unless 'b 'a)
18  nil)
19
20(deftest unless.4
21  (unless nil 'a)
22  a)
23
24(deftest unless.5 (unless nil (values)))
25
26(deftest unless.6
27  (unless nil (values 1 2 3 4))
28  1 2 3 4)
29
30(deftest unless.7
31  (unless 1 (values))
32  nil)
33
34(deftest unless.8
35  (unless #() (values 1 2 3 4))
36  nil)
37
38(deftest unless.9
39  (let ((x 0))
40    (values
41     (unless nil
42       (incf x)
43       'a)
44     x))
45  a 1)
46
47;;; No implicit tagbody
48(deftest unless.10
49  (block done
50    (tagbody
51     (unless nil
52       (go 10)
53       10
54       (return-from done 'bad))
55     10
56     (return-from done 'good)))
57  good)
58
59;;; Test that explicit calls to macroexpand in subforms
60;;; are done in the correct environment
61
62(deftest unless.11
63  (macrolet
64   ((%m (z) z))
65   (unless (expand-in-current-env (%m nil)) :good))
66  :good)
67
68(deftest unless.12
69  (macrolet
70   ((%m (z) z))
71   (unless (expand-in-current-env (%m t)) :bad))
72  nil)
73
74(deftest unless.13
75  (macrolet
76   ((%m (z) z))
77   (let ((x 1) (p nil))
78     (values
79      (unless p (expand-in-current-env (%m (incf x))))
80      x)))
81  2 2)
82
83(deftest unless.error.1
84  (signals-error (funcall (macro-function 'unless)) program-error)
85  t)
86
87(deftest unless.error.2
88  (signals-error (funcall (macro-function 'unless)
89                           '(unless t))
90                 program-error)
91  t)
92
93(deftest unless.error.3
94  (signals-error (funcall (macro-function 'unless)
95                           '(unless t) nil nil)
96                 program-error)
97  t)
Note: See TracBrowser for help on using the repository browser.