prog1.lsp 777 Bytes
Newer Older
1 2 3 4 5
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Oct 19 09:37:14 2002
;;;; Contains: Tests for PROG1

6

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

(deftest prog1.1
  (prog1 'a)
  a)

(deftest prog1.2
  (prog1 'a 'b)
  a)

(deftest prog1.3
  (prog1 (values 'a 'b) 'c)
  a)

(deftest prog1.4
  (prog1 (values) 'c)
  nil)

(deftest prog1.5
  (let ((x 0))
    (values (prog1 x (incf x)) x))
  0 1)
28 29 30 31 32 33 34 35 36 37

;;; Test that prog1 doesn't have a tagbody

(deftest prog1.6
  (block nil
    (tagbody
     (return (prog1 'bad (go 10) 10))
     10
     (return 'good)))
  good)
38

39 40 41 42 43 44 45 46 47
;;; Test that explicit calls to macroexpand in subforms
;;; are done in the correct environment

(deftest prog1.7
  (macrolet
   ((%m (z) z))
   (prog1 (expand-in-current-env (%m 'good))))
  good)

48
(def-macro-test prog1.error.1 (prog1 nil))