unless.lsp 634 Bytes
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
45
46
47
48
49
50
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Fri Oct 18 19:39:34 2002
;;;; Contains: Tests of UNLESS

(in-package :cl-test)

(deftest unless.1
  (unless t)
  nil)

(deftest unless.2
  (unless nil)
  nil)

(deftest unless.3
  (unless 'b 'a)
  nil)

(deftest unless.4
  (unless nil 'a)
  a)

(deftest unless.5 (unless nil (values)))

(deftest unless.6
  (unless nil (values 1 2 3 4))
  1 2 3 4)

(deftest unless.7
  (unless 1 (values))
  nil)

(deftest unless.8
  (unless #() (values 1 2 3 4))
  nil)

(deftest unless.9
  (let ((x 0))
    (values
     (unless nil
       (incf x)
       'a)
     x))
  a 1)