source: trunk/source/tests/ansi-tests/apropos.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:  Sun Dec 12 16:17:47 2004
4;;;; Contains: Tests for APROPOS
5
6(in-package :cl-test)
7
8(deftest apropos.1
9  (loop for n from 10
10        for x = (coerce (loop repeat n collect (random-from-seq +standard-chars+)) 'string)
11        unless (apropos-list x)
12        return (with-output-to-string (*standard-output*)
13                                      (assert (null (multiple-value-list (apropos x))))))
14  "")
15
16(deftest apropos.2
17  (let ((s (with-output-to-string
18             (*standard-output*)
19             (assert (null (multiple-value-list (apropos "CAR")))))))
20    (notnot (search "CAR" s :test #'string-equal)))
21  t)
22
23(deftest apropos.3
24  (let ((s (with-output-to-string
25             (*standard-output*)
26             (assert (null (multiple-value-list (apropos "CAR" (find-package "CL"))))))))
27    (notnot (search "CAR" s :test #'string-equal)))
28  t)
29
30(deftest apropos.4
31  (let ((result nil))
32    (do-special-strings
33     (s "CAR" t)
34     (setq result (with-output-to-string
35                    (*standard-output*)
36                    (assert (null (multiple-value-list (apropos s))))))
37     (assert (search "CAR" result :test #'string-equal))))
38  t)
39
40(deftest apropos.5
41  (let ((result nil)
42        (pkg (find-package "COMMON-LISP")))
43    (do-special-strings
44     (s "APROPOS" t)
45     (setq result (with-output-to-string
46                    (*standard-output*)
47                    (assert (null (multiple-value-list (apropos s pkg))))))
48     (assert (search "APROPOS" result :test #'string-equal))))
49  t)
50
51(deftest apropos.6
52  (let ((s (with-output-to-string
53             (*standard-output*)
54             (assert (null (multiple-value-list (apropos "CAR" "CL")))))))
55    (notnot (search "CAR" s :test #'string-equal)))
56  t)
57
58(deftest apropos.7
59  (let ((s (with-output-to-string
60             (*standard-output*)
61             (assert (null (multiple-value-list (apropos "CAR" :|CL|)))))))
62    (notnot (search "CAR" s :test #'string-equal)))
63  t)
64
65(deftest apropos.8
66  (let ((s (with-output-to-string
67             (*standard-output*)
68             (assert (null (multiple-value-list (apropos "CAR" nil)))))))
69    (notnot (search "CAR" s :test #'string-equal)))
70  t)
71
72(deftest apropos.9
73  (macrolet
74   ((%m (z) z))
75   (let ((s (with-output-to-string
76              (*standard-output*)
77              (assert (null (multiple-value-list
78                             (apropos (expand-in-current-env (%m "CAR")))))))))
79     (notnot (search "CAR" s :test #'string-equal))))
80  t)
81
82(deftest apropos.10
83  (macrolet
84   ((%m (z) z))
85   (let ((s (with-output-to-string
86              (*standard-output*)
87              (assert (null (multiple-value-list
88                             (apropos "CAR"
89                                      (expand-in-current-env (%m nil)))))))))
90     (notnot (search "CAR" s :test #'string-equal))))
91  t)
92
93;;; Error tests
94
95(deftest apropos.error.1
96  (signals-error (apropos) program-error)
97  t)
98
99(deftest apropos.error.2
100  (signals-error (apropos "SJLJALKSJDKLJASKLDJKLAJDLKJA" (find-package "CL") nil) program-error)
101  t)
Note: See TracBrowser for help on using the repository browser.