Raymond Toy pushed to branch issue-157-directory-returns-all-files at cmucl / cmucl
Commits: 30abe6eb by Raymond Toy at 2023-03-04T10:33:48-08:00 Fix up test issues for pathnames.
With the updated pathname-match-p function, some of the existing pathname tests were not correct.
For example "/tmp/foo.lisp" should NOT match "foo:*" because only the name is `:WILD`. The type is `NIL`, so "foo.lisp" doesn't match. We change the test to assert it fails and added a version where it should pass.
There was also in trying to match different search-lists where we forgot to call `pathname-match-p`. Oops.
- - - - -
1 changed file:
- tests/pathname.lisp
Changes:
===================================== tests/pathname.lisp ===================================== @@ -19,28 +19,33 @@ (:tag :search-list) ;; Basic tests where the wild path is search-list
- (assert-true (pathname-match-p "/tmp/foo.lisp" "foo:*")) - (assert-true (pathname-match-p "/tmp/zot/foo.lisp" "foo:**/*")) + (assert-false (pathname-match-p "/tmp/foo.lisp" "foo:*")) + (assert-true (pathname-match-p "/tmp/foo.lisp" "foo:*.*")) + (assert-false (pathname-match-p "/tmp/zot/foo.lisp" "foo:**/*")) + (assert-true (pathname-match-p "/tmp/zot/foo.lisp" "foo:**/*.*")) (assert-true (pathname-match-p "/tmp/zot/foo.lisp" "foo:**/*.lisp")) ;; These match because the second entry of the "foo:" search list is ;; "/usr/". - (assert-true (pathname-match-p "/usr/foo.lisp" "foo:*")) + (assert-false (pathname-match-p "/usr/foo.lisp" "foo:*")) + (assert-true (pathname-match-p "/usr/foo.lisp" "foo:*.*")) (assert-true (pathname-match-p "/usr/bin/foo" "foo:**/*")) (assert-true (pathname-match-p "/usr/bin/foo.lisp" "foo:**/*.lisp"))
;; This fails because "/bin/" doesn't match any path of the search ;; list. - (assert-false (pathname-match-p "/bin/foo.lisp" "foo:*")) + (assert-false (pathname-match-p "/bin/foo.lisp" "foo:*.*"))
;; Basic test where the pathname is a search-list and the wild path is not. - (assert-true (pathname-match-p "foo:foo.lisp" "/tmp/*")) + (assert-false (pathname-match-p "foo:foo.lisp" "/tmp/*")) + (assert-true (pathname-match-p "foo:foo.lisp" "/tmp/*.*")) (assert-true (pathname-match-p "foo:foo" "/usr/*")) + (assert-true (pathname-match-p "foo:foo" "/usr/*.*")) (assert-true (pathname-match-p "foo:zot/foo.lisp" "/usr/**/*.lisp"))
(assert-false (pathname-match-p "foo:foo" "/bin/*"))
;; Tests where both args are search-lists. - (assert-true "foo:foo.lisp" "bar:*")) + (assert-true (pathname-match-p "foo:foo.lisp" "bar:*.*")))
;; Verify PATHNAME-MATCH-P works with logical pathnames. (Issue 27) ;; This test modeled after a test from asdf
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/30abe6ebd71ba3bcee4438fc...