source: trunk/source/tests/ansi-tests/in-package.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: 2.8 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 25 08:06:03 1998
4;;;; Contains: Tests of IN-PACKAGE
5
6(in-package :cl-test)
7(declaim (optimize (safety 3)))
8
9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10;;; in-package
11
12(deftest in-package.1
13  (let ((*package* *package*))
14    (safely-delete-package "H")
15    (make-package "H" :use ())
16    (let ((p2 (in-package "H")))
17      (and (eqt p2 (find-package "H"))
18           (eqt *package* p2))))
19  t)
20
21(deftest in-package.2
22  (let ((*package* *package*))
23    (safely-delete-package "H")
24    (make-package "H" :use ())
25    (let ((p2 (in-package |H|)))
26      (and (eqt p2 (find-package "H"))
27           (eqt *package* p2))))
28  t)
29
30(deftest in-package.3
31  (let ((*package* *package*))
32    (safely-delete-package "H")
33    (make-package "H" :use ())
34    (let ((p2 (in-package :|H|)))
35      (and (eqt p2 (find-package "H"))
36           (eqt *package* p2))))
37  t)
38
39(deftest in-package.4
40  (let ((*package* *package*))
41    (safely-delete-package "H")
42    (make-package "H" :use ())
43    (let ((p2 (in-package #\H)))
44      (and (eqt p2 (find-package "H"))
45           (eqt *package* p2))))
46  t)
47
48(deftest in-package.5
49  (let ((*package* *package*))
50    (safely-delete-package "H")
51    (handler-case
52     (eval '(in-package "H"))
53     (package-error () 'package-error)
54     (error (c) c)))
55  package-error)
56
57(def-macro-test in-package.error.1
58  (in-package :cl-test))
59
60(defmacro def-in-package-test (test-name name-form)
61  `(deftest ,test-name
62     (let ((name ,name-form))
63       (safely-delete-package name)
64       (prog1
65           (let* ((p (make-package name :use nil))
66                  (*package* *package*)
67                  (p2 (eval `(in-package ,name))))
68             (list (eqt p p2)
69                   (eqt p *package*)))
70         (safely-delete-package name)))
71     (t t)))
72
73(def-in-package-test in-package.7
74  (make-array 5 :initial-contents "TEST1" :element-type 'base-char))
75
76(def-in-package-test in-package.8
77  (make-array 10 :initial-contents "TEST1ABCDE"
78              :fill-pointer 5 :element-type 'base-char))
79
80(def-in-package-test in-package.9
81  (make-array 10 :initial-contents "TEST1ABCDE"
82              :fill-pointer 5 :element-type 'character))
83
84(def-in-package-test in-package.10
85  (make-array 5 :initial-contents "TEST1"
86              :adjustable t :element-type 'base-char))
87
88(def-in-package-test in-package.11
89  (make-array 5 :initial-contents "TEST1"
90              :adjustable t :element-type 'character))
91
92(def-in-package-test in-package.12
93  (let* ((etype 'base-char)
94         (name0 (make-array 10 :element-type etype
95                            :initial-contents "xxxxxTEST1")))
96    (make-array 5 :element-type etype
97                :displaced-to name0
98                :displaced-index-offset 5)))
99
100(def-in-package-test in-package.13
101  (let* ((etype 'character)
102         (name0 (make-array 10 :element-type etype
103                            :initial-contents "xxxxxTEST1")))
104    (make-array 5 :element-type etype
105                :displaced-to name0
106                :displaced-index-offset 5)))
Note: See TracBrowser for help on using the repository browser.