source: trunk/source/tests/ansi-tests/prog2.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: 1.0 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Oct 19 09:40:51 2002
4;;;; Contains: Tests for PROG2
5
6(in-package :cl-test)
7
8(deftest prog2.1
9  (prog2 'a 'b)
10  b)
11
12(deftest prog2.2
13  (prog2 'a 'b 'c)
14  b)
15
16(deftest prog2.3
17  (prog2 'a (values) 'c)
18  nil)
19
20(deftest prog2.4
21  (prog2 'a (values 'b 'd) 'c)
22  b)
23
24(deftest prog2.5
25  (let ((x 0))
26    (values
27     (prog2 (incf x) (incf x) (incf x))
28     x))
29  2 3)
30
31(deftest prog2.6
32  (let ((x 1))
33    (values
34     (prog2 (incf x (1+ x)) (incf x (+ 2 x)) (incf x 100))
35     x))
36  8 108)
37
38;;; Test that prog2 doesn't have a tagbody
39
40(deftest prog2.7
41  (block nil
42    (tagbody
43     (return (prog2 17 'bad (go 10) 10))
44     10
45     (return 'good)))
46  good)
47
48;;; Test that explicit calls to macroexpand in subforms
49;;; are done in the correct environment
50
51(deftest prog2.8
52  (macrolet
53   ((%m (z) z))
54   (prog2
55       (expand-in-current-env (%m 'bad1))
56       (expand-in-current-env (%m 'good))
57       (expand-in-current-env (%m 'bad2))))
58  good)
59
60(def-macro-test prog2.error.1 (prog2 nil nil))
Note: See TracBrowser for help on using the repository browser.