source: trunk/source/tests/ansi-tests/find-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: 3.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sat Apr 25 07:50:39 1998
4;;;; Contains: Tests for FIND-PACKAGE
5
6(in-package :cl-test)
7(declaim (optimize (safety 3)))
8
9;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10;;; find-package
11
12(deftest find-package.1
13  (let ((p (find-package "CL"))
14        (p2 (find-package "COMMON-LISP")))
15    (and p p2 (eqt p p2)))
16  t)
17
18(deftest find-package.2
19  (let ((p (find-package "CL-USER"))
20        (p2 (find-package "COMMON-LISP-USER")))
21    (and p p2 (eqt p p2)))
22  t)
23
24(deftest find-package.3
25  (let ((p (find-package "KEYWORD")))
26    (and p (eqt p (symbol-package :test))))
27  t)
28
29(deftest find-package.4
30  (progn
31    (set-up-packages)
32    (let ((p (ignore-errors (find-package "A"))))
33      (if (packagep p)
34          t
35        p)))
36  t)
37
38(deftest find-package.5
39  (progn
40    (set-up-packages)
41    (let ((p (ignore-errors (find-package #\A))))
42      (if (packagep p)
43          t
44        p)))
45  t)
46
47(deftest find-package.6
48  (progn
49    (set-up-packages)
50    (let ((p (ignore-errors (find-package "B"))))
51      (if (packagep p)
52          t
53        p)))
54  t)
55
56(deftest find-package.7
57  (progn
58    (set-up-packages)
59    (let ((p (ignore-errors (find-package #\B))))
60      (if (packagep p)
61          t
62        p)))
63  t)
64
65(deftest find-package.8
66  (progn
67    (set-up-packages)
68    (let ((p (ignore-errors (find-package "Q")))
69          (p2 (ignore-errors (find-package "A"))))
70      (and (packagep p)
71           (packagep p2)
72           (eqt p p2))))
73  t)
74
75(deftest find-package.9
76  (progn
77    (set-up-packages)
78    (let ((p (ignore-errors (find-package "A")))
79          (p2 (ignore-errors (find-package "B"))))
80      (eqt p p2)))
81  nil)
82
83(deftest find-package.10
84  (progn
85    (set-up-packages)
86    (let ((p (ignore-errors (find-package #\Q)))
87          (p2 (ignore-errors (find-package "Q"))))
88      (and (packagep p)
89           (eqt p p2))))
90  t)
91
92(deftest find-package.11
93  (let* ((cl (find-package "CL"))
94         (cl2 (find-package cl)))
95    (and (packagep cl)
96         (eqt cl cl2)))
97  t)
98
99(deftest find-package.12
100  (let* ((name (make-array '(7) :initial-contents "KEYWORD"
101                           :element-type 'base-char))
102         (p (find-package name)))
103    (and p (eqt p (symbol-package :test))))
104  t)
105
106(deftest find-package.13
107  (let* ((name (make-array '(10) :initial-contents "KEYWORDXYZ"
108                           :fill-pointer 7
109                           :element-type 'base-char))
110         (p (find-package name)))
111    (and p (eqt p (symbol-package :test))))
112  t)
113
114(deftest find-package.14
115  (let* ((name (make-array '(10) :initial-contents "KEYWORDXYZ"
116                           :fill-pointer 7
117                           :element-type 'character))
118         (p (find-package name)))
119    (and p (eqt p (symbol-package :test))))
120  t)
121
122(deftest find-package.15
123  (let* ((name0 (make-array '(10) :initial-contents "XYKEYWORDZ"
124                            :element-type 'character))
125         (name (make-array '(7) :displaced-to name0 :displaced-index-offset 2
126                           :element-type 'character))
127         (p (find-package name)))
128    (and p (eqt p (symbol-package :test))))
129  t)
130
131(deftest find-package.16
132  (let* ((name (make-array '(7) :initial-contents "KEYWORD"
133                           :adjustable t
134                           :element-type 'base-char))
135         (p (find-package name)))
136    (and p (eqt p (symbol-package :test))))
137  t)
138
139(deftest find-package.17
140  (let* ((name (make-array '(7) :initial-contents "KEYWORD"
141                           :adjustable t
142                           :element-type 'character))
143         (p (find-package name)))
144    (and p (eqt p (symbol-package :test))))
145  t)
146
147;;; Error tests
148
149(deftest find-package.error.1
150  (signals-error (find-package) program-error)
151  t)
152
153(deftest find-package.error.2
154  (signals-error (find-package "CL" nil) program-error)
155  t)
Note: See TracBrowser for help on using the repository browser.