... |
... |
@@ -43,7 +43,7 @@ |
43
|
43
|
(assert-true (pathname-match-p "foo:zot/foo.lisp" "/usr/**/*.lisp"))
|
44
|
44
|
|
45
|
45
|
(assert-false (pathname-match-p "foo:foo" "/bin/*"))
|
46
|
|
-
|
|
46
|
+
|
47
|
47
|
;; Tests where both args are search-lists.
|
48
|
48
|
(assert-true (pathname-match-p "foo:foo.lisp" "bar:*.*")))
|
49
|
49
|
|
... |
... |
@@ -68,7 +68,12 @@ |
68
|
68
|
:name :wild :type :wild :version nil)))
|
69
|
69
|
("**;*"
|
70
|
70
|
,(merge-pathnames (make-pathname :directory '(:relative "asdf-src" :wild-inferiors)
|
71
|
|
- :name :wild :type nil :version nil)))))))
|
|
71
|
+ :name :wild :type nil :version nil)))
|
|
72
|
+ ("tests;**;*.*"
|
|
73
|
+ "**/*.*")))
|
|
74
|
+ (setf (logical-pathname-translations "test")
|
|
75
|
+ '(("**;*.*" "tests/**/*.*")
|
|
76
|
+ ("**;*.*.*" "tests/**/*.*.~*~")))))
|
72
|
77
|
(setup-logical-host)
|
73
|
78
|
|
74
|
79
|
(define-test pathname-match-p.logical-pathname
|
... |
... |
@@ -77,4 +82,77 @@ |
77
|
82
|
:directory '(:absolute "system2" "module4")
|
78
|
83
|
:name nil :type nil)
|
79
|
84
|
(parse-namestring "ASDFTEST:system2;module4;"))))
|
80
|
|
- |
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+(define-test pathname-match-p.unspecific
|
|
89
|
+ ;; Test that a field of :unspecific matches nil.
|
|
90
|
+ (let ((wild-path #p"**/*.*"))
|
|
91
|
+ (assert-true (pathname-match-p (make-pathname :device :unspecific)
|
|
92
|
+ wild-path))
|
|
93
|
+ (assert-true (pathname-match-p (make-pathname :name :unspecific)
|
|
94
|
+ wild-path))
|
|
95
|
+ (assert-true (pathname-match-p (make-pathname :type :unspecific)
|
|
96
|
+ wild-path))
|
|
97
|
+ (assert-true (pathname-match-p (make-pathname :version :unspecific)
|
|
98
|
+ wild-path))
|
|
99
|
+ ;; Slightly more complicated pathnames with :unspecific
|
|
100
|
+ (assert-true (pathname-match-p (make-pathname :device :unspecific
|
|
101
|
+ :name "foo"
|
|
102
|
+ :type "bar")
|
|
103
|
+ wild-path))
|
|
104
|
+ (assert-true (pathname-match-p (make-pathname :directory '(:relative "a")
|
|
105
|
+ :name :unspecific
|
|
106
|
+ :type "bar")
|
|
107
|
+ wild-path))
|
|
108
|
+ (assert-true (pathname-match-p (make-pathname :directory '(:relative "a")
|
|
109
|
+ :name "foo"
|
|
110
|
+ :type :unspecific)
|
|
111
|
+ wild-path))
|
|
112
|
+ (assert-true (pathname-match-p (make-pathname :directory '(:relative "a")
|
|
113
|
+ :name "foo"
|
|
114
|
+ :type "bar"
|
|
115
|
+ :version :unspecific)
|
|
116
|
+ wild-path))))
|
|
117
|
+
|
|
118
|
+(define-test directory-pathname-match-p
|
|
119
|
+ ;; Test that directory and pathname-match-p are consistent
|
|
120
|
+ (let* ((wild-path #P"**/*.*")
|
|
121
|
+ (dir (directory wild-path :truenamep nil)))
|
|
122
|
+ (loop for p in dir
|
|
123
|
+ do
|
|
124
|
+ (assert-true (pathname-match-p p wild-path)))))
|
|
125
|
+
|
|
126
|
+(define-test directory-pathname-match-p.lpn
|
|
127
|
+ ;; Like directory-pathname-match-p but for a logical pathname
|
|
128
|
+ (let* ((wild-path #P"ASDFTEST:**;*.*.*")
|
|
129
|
+ (dir (directory wild-path :truenamep nil)))
|
|
130
|
+ (loop for p in dir
|
|
131
|
+ do
|
|
132
|
+ (assert-true (pathname-match-p p wild-path)))))
|
|
133
|
+
|
|
134
|
+(define-test directory-consistent-pn-vs-lpn
|
|
135
|
+ ;; Test the directory with a physical pathname and a logical
|
|
136
|
+ ;; pathname return the same files.
|
|
137
|
+ (let ((dir-pn (directory #P"tests/**/*.*" :truenamep nil))
|
|
138
|
+ (dir-lpn (directory #P"test:**;*.*.*" :truenamep nil)))
|
|
139
|
+ ;; The number of entries should be the same.
|
|
140
|
+ (assert-equal (length dir-pn) (length dir-lpn)
|
|
141
|
+ dir-pn dir-lpn)
|
|
142
|
+ (loop for pn in dir-pn
|
|
143
|
+ for lpn in dir-lpn
|
|
144
|
+ do
|
|
145
|
+ (assert-equal pn lpn))))
|
|
146
|
+
|
|
147
|
+(define-test directory-only
|
|
148
|
+ ;; Test that we only get directories when requested
|
|
149
|
+ (let ((dirs (directory #P"tests/**/" :truenamep nil)))
|
|
150
|
+ (loop for p in dirs
|
|
151
|
+ do
|
|
152
|
+ (assert-false (pathname-name p) p)
|
|
153
|
+ (assert-false (pathname-type p) p)
|
|
154
|
+ (assert-true (let ((version (pathname-version p)))
|
|
155
|
+ (or (null version)
|
|
156
|
+ (eq version :newest)))
|
|
157
|
+ p))))
|
|
158
|
+ |