progn.lsp 1.03 KB
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
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Oct 19 09:33:51 2002
;;;; Contains: Tests of PROGN

(in-package :cl-test)

(deftest progn.1
  (progn)
  nil)

(deftest progn.2
  (progn 'a)
  a)

(deftest progn.3
  (progn 'b 'a)
  a)

(deftest progn.4
  (let ((x 0))
    (values (progn (incf x) x) x))
  1 1)

(deftest progn.5 (progn (values)))

(deftest progn.6
  (progn (values 1 2) (values 'a 'b 'c 'd 'e))
  a b c d e)

(deftest progn.7
  (let ((x 0))
    (prog ()
sds's avatar
sds committed
34
35
36
37
          (progn (go x) x 'a)
          (return 'bad)
          x
          (return 'good)))
38
  good)
39
40
41
42
43
44
45
46
47
48
49

;;; No implicit tagbody
(deftest progn.8
  (block nil
    (tagbody
     (progn
      (go 10)
      10
      (return 'bad))
     10
     (return 'good)))
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  good)

;;; Macros are expanded in the appropriate environment

(deftest progn.9
  (macrolet
   ((%m (z) z))
   (progn (expand-in-current-env (%m :good))))
  :good)

(deftest progn.10
  (macrolet
   ((%m (z) z))
   (progn (expand-in-current-env (%m :bad))
sds's avatar
sds committed
64
          (expand-in-current-env (%m :good))))
65
66
67
  :good)