source: trunk/source/tests/ansi-tests/multiple-value-list.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.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Mon Feb 17 06:38:07 2003
4;;;; Contains: Tests of MULTIPLE-VALUE-LIST
5
6(in-package :cl-test)
7
8(deftest multiple-value-list.1
9  (multiple-value-list 'a)
10  (a))
11
12(deftest multiple-value-list.2
13  (multiple-value-list (values))
14  nil)
15
16(deftest multiple-value-list.3
17  (multiple-value-list (values 'a 'b 'c 'd 'e))
18  (a b c d e))
19
20(deftest multiple-value-list.4
21  (multiple-value-list (values (values 'a 'b 'c 'd 'e)))
22  (a))
23
24(deftest multiple-value-list.5
25  (multiple-value-list (values 'a))
26  (a))
27
28(deftest multiple-value-list.6
29  (multiple-value-list (values 'a 'b))
30  (a b))
31
32(deftest multiple-value-list.7
33  (not
34   (loop
35    for i from 0 below (min multiple-values-limit 100)
36    for x = (make-list i :initial-element 'a)
37    always (equal x (multiple-value-list (values-list x)))))
38  nil)
39
40;;; Test that explicit calls to macroexpand in subforms
41;;; are done in the correct environment
42
43(deftest multiple-value-list.8
44  (macrolet
45   ((%m (z) z))
46   (multiple-value-list (expand-in-current-env (%m 1))))
47  (1))
48
49(deftest multiple-value-list.9
50  (macrolet
51   ((%m (z) z))
52   (multiple-value-list (expand-in-current-env (%m (values 1 2 3)))))
53  (1 2 3))
54
55;;; Test that the argument is evaluated just once
56
57(deftest multiple-value-list.order.1
58  (let ((i 0))
59    (values (multiple-value-list (incf i)) i))
60  (1) 1)
61
62;;; Error tests
63
64(deftest multiple-value-list.error.1
65  (signals-error (funcall (macro-function 'multiple-value-list))
66                 program-error)
67  t)
68 
69(deftest multiple-value-list.error.2
70  (signals-error (funcall (macro-function 'multiple-value-list)
71                           '(multiple-value-list nil))
72                 program-error)
73  t)
74
75(deftest multiple-value-list.error.3
76  (signals-error (funcall (macro-function 'multiple-value-list)
77                           '(multiple-value-list nil)
78                           nil nil)
79                 program-error)
80  t)
Note: See TracBrowser for help on using the repository browser.