source: trunk/tests/ansi-tests/pathname-match-p.lsp @ 9045

Last change on this file since 9045 was 9045, checked in by gz, 12 years ago

Assorted cleanup:

In infrastructure:

  • add *test-verbose* and :verbose argument to do-test and do-tests. Avoid random output if false, only show failures
  • muffle-wawrnings and/or bind *suppress-compiler-warnings* in some tests that unavoidably generate them (mainly with duplicate typecase/case clauses)
  • Add record-source-file for tests so meta-. can find them
  • If *catch-errors* (or the :catch-errors arg) is :break, enter a breakloop when catch an error
  • Make test fns created by *compile-tests* have names, so can find them in backtraces
  • fix misc compiler warnings
  • Fixed cases of duplicate test numbers
  • Disable note :make-condition-with-compound-name for openmcl.

In tests themselves:

I commented out the following tests with #+bogus-test, because they just seemed wrong to me:

lambda.47
lambda.50
upgraded-array-element-type.8
upgraded-array-element-type.nil.1
pathname-match-p.5
load.17
load.18
macrolet.47
ctypecase.15

In addition, I commented out the following tests with #+bogus-test because I was too lazy to make a note
for "doesn't signal underflow":

exp.error.8 exp.error.9 exp.error.10 exp.error.11 expt.error.8 expt.error.9 expt.error.10 expt.error.11

Finally, I entered bug reports in trac, and then commented out the tests
below with #+known-bug-NNN, where nnn is the ticket number in trac:

ticket#268: encode-universal-time.3 encode-universal-time.3.1
ticket#269: macrolet.36
ticket#270: values.20 values.21
ticket#271: defclass.error.13 defclass.error.22
ticket#272: phase.10 phase.12 asin.5 asin.6 asin.8
ticket#273: phase.18 phase.19 acos.8
ticket#274: exp.error.4 exp.error.5 exp.error.6 exp.error.7
ticket#275: car.error.2 cdr.error.2
ticket#276: map.error.11
ticket#277: subtypep.cons.43
ticket#278: subtypep-function.3
ticket#279: subtypep-complex.8
ticket#280: open.output.19 open.io.19 file-position.8 file-length.4 file-length.5 read-byte.4 stream-element-type.2 stream-element-type.3
ticket#281: open.65
ticket#288: set-syntax-from-char.sharp.1

File size: 2.6 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Aug 15 07:46:22 2004
4;;;; Contains: Tests for PATHNAME-MATCH-P
5
6(in-package :cl-test)
7
8(compile-and-load "pathnames-aux.lsp")
9
10;;; Much of the behavior cannot be tested portably.
11
12(deftest pathname-match-p.1
13  (let ((pn1 (make-pathname :name :wild))
14        (pn2 (make-pathname :name "foo")))
15    (pathname-match-p pn1 pn2))
16  nil)
17
18(deftest pathname-match-p.2
19  (let ((pn1 (make-pathname :type :wild))
20        (pn2 (make-pathname :type "txt")))
21    (pathname-match-p pn1 pn2))
22  nil)
23
24(deftest pathname-match-p.3
25  (let ((pn1 (make-pathname :directory '(:absolute :wild)))
26        (pn2 (make-pathname :directory '(:absolute))))
27    (pathname-match-p pn1 pn2))
28  nil)
29
30(deftest pathname-match-p.4
31  (let ((pn1 (make-pathname :directory '(:relative :wild)))
32        (pn2 (make-pathname :directory '(:relative))))
33    (pathname-match-p pn1 pn2))
34  nil)
35
36#+bogus-test
37(deftest pathname-match-p.5
38  (let ((pn1 (make-pathname :directory '(:relative :wild)))
39        (pn2 (make-pathname :directory nil)))
40    (and (wild-pathname-p pn1)
41         (not (pathname-directory pn2))
42         (not (pathname-match-p pn1 pn2))))
43  nil)
44
45(deftest pathname-match-p.6
46  (let ((pn1 (make-pathname :version :wild))
47        (pn2 (make-pathname)))
48    (and (wild-pathname-p pn1)
49         (not (pathname-version pn2))
50         (not (pathname-match-p pn1 pn2))))
51  nil)
52
53;;; Specialized string tests
54
55(deftest pathname-match-p.7
56  (let ((wpn (parse-namestring "CLTEST:*.LSP")))
57    (assert (wild-pathname-p wpn))
58    (do-special-strings
59     (s "CLTEST:FOO.LSP" nil)
60     (assert (pathname-match-p s wpn))))
61  nil)
62
63(deftest pathname-match-p.8
64  (do-special-strings
65   (s "CLTEST:*.LSP" nil)
66   (assert (pathname-match-p "CLTEST:FOO.LSP" s)))
67  nil)
68   
69
70;;; Add more tests here
71
72;;; Here are error tests
73
74(deftest pathname-match-p.error.1
75  (signals-error (pathname-match-p) program-error)
76  t)
77
78(deftest pathname-match-p.error.2
79  (signals-error (pathname-match-p #p"") program-error)
80  t)
81
82(deftest pathname-match-p.error.3
83  (signals-error (pathname-match-p #p"" #p"" nil) program-error)
84  t)
85
86(deftest pathname-match-p.error.4
87  (check-type-error #'(lambda (x) (pathname-match-p x #p""))
88                    #'could-be-pathname-designator)
89  nil)
90
91(deftest pathname-match-p.error.5
92  (check-type-error #'(lambda (x) (declare (optimize (safety 0))) (pathname-match-p x #p""))
93                    #'could-be-pathname-designator)
94  nil)
95
96(deftest pathname-match-p.error.6
97  (check-type-error #'(lambda (x) (pathname-match-p #p"" x))
98                    #'could-be-pathname-designator)
99  nil)
100
101(deftest pathname-match-p.error.7
102  (check-type-error #'(lambda (x) (declare (optimize (safety 0))) (pathname-match-p #p"" x))
103                    #'could-be-pathname-designator)
104  nil)
Note: See TracBrowser for help on using the repository browser.