source: trunk/source/tests/ansi-tests/push.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.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 22:05:34 2003
4;;;; Contains: Tests of PUSH
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10;;; See also places.lsp
11
12(deftest push.1
13  (let ((x nil))
14    (push 'a x))
15  (a))
16
17(deftest push.2
18  (let ((x 'b))
19    (push 'a x)
20    (push 'c x))
21  (c a . b))
22
23(deftest push.3
24  (let ((x (copy-tree '(a))))
25    (push x x)
26    (and
27     (eqt (car x) (cdr x))
28     x))
29  ((a) a))
30
31;;; Test that explicit calls to macroexpand in subforms
32;;; are done in the correct environment
33
34(deftest push.4
35  (macrolet
36   ((%m (z) z))
37   (let ((x nil))
38     (values
39      (push (expand-in-current-env (%m 1)) x)
40      x)))
41  (1) (1))
42
43(deftest push.5
44  (macrolet
45   ((%m (z) z))
46   (let ((x nil))
47     (values
48      (push 1 (expand-in-current-env (%m x)))
49      x)))
50  (1) (1))
51
52(deftest push.order.1
53  (let ((x (list nil)) (i 0) a b)
54    (values
55     (push (progn (setf a (incf i)) 'z)
56           (car (progn (setf b (incf i)) x)))
57     x
58     i a b))
59  (z) ((z)) 2 1 2)
60
61(deftest push.order.2
62  (let ((x (vector nil nil nil nil))
63        (y (vector 'a 'b 'c 'd))
64        (i 1))
65    (push (aref y (incf i)) (aref x (incf i)))
66    (values x y i))
67  #(nil nil nil (c))
68  #(a b c d)
69  3)
70
71(deftest push.order.3
72  (let ((x '(a b c)))
73    (values
74     (push (progn (setq x '(d e)) 'z) x)
75     x))
76  (z d e) (z d e))
77
78(def-macro-test push.error.1 (push x y))
79
80;;; Need to add push vs. various accessors
Note: See TracBrowser for help on using the repository browser.