source: trunk/source/tests/ansi-tests/pop.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: 1019 bytes
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 19 22:27:18 2003
4;;;; Contains: Tests of POP
5
6(in-package :cl-test)
7
8(compile-and-load "cons-aux.lsp")
9
10(deftest pop.1
11  (let ((x (copy-tree '(a b c))))
12    (let ((y (pop x)))
13      (list x y)))
14  ((b c) a))
15
16(deftest pop.2
17  (let ((x nil))
18    (let ((y (pop x)))
19      (list x y)))
20  (nil nil))
21
22;;; Test that explicit calls to macroexpand in subforms
23;;; are done in the correct environment
24
25(deftest pop.3
26  (macrolet
27   ((%m (z) z))
28   (let ((x (list 'a 'b 'c)))
29     (values
30      (pop (expand-in-current-env (%m x)))
31      x)))
32  a (b c))
33
34;;; Confirm argument is executed just once.
35(deftest pop.order.1
36  (let ((i 0)
37        (a (vector (list 'a 'b 'c))))
38    (pop (aref a (progn (incf i) 0)))
39    (values a i))
40  #((b c)) 1)
41
42(deftest push-and-pop
43  (let* ((x (copy-tree '(a b)))
44         (y x))
45    (push 'c x)
46    (and
47     (eqt (cdr x) y)
48     (pop x)))
49  c)
50
51(def-macro-test pop.error.1 (pop x))
52
53;;; Need to add tests of POP vs. various accessors
Note: See TracBrowser for help on using the repository browser.