mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
ftw: Include sub-directories in the result of `scandir'.
* module/ice-9/ftw.scm (scandir)[skip]: Keep NAME in the resulting list. * test-suite/tests/ftw.test ("scandir")["top-srcdir"]: New test.
This commit is contained in:
parent
52b680f85e
commit
a2c66014cf
2 changed files with 13 additions and 1 deletions
|
@ -530,7 +530,7 @@ of file names is sorted according to ENTRY<?, which defaults to
|
|||
|
||||
(define (skip name stat result)
|
||||
;; All the sub-directories are skipped.
|
||||
result)
|
||||
(cons (basename name) result))
|
||||
|
||||
(and=> (file-system-fold enter? leaf down up skip #f name stat)
|
||||
(lambda (files)
|
||||
|
|
|
@ -169,6 +169,18 @@
|
|||
|
||||
(with-test-prefix "scandir"
|
||||
|
||||
(pass-if "top-srcdir"
|
||||
(let ((valid? (negate (cut string-any #\/ <>))))
|
||||
(match (scandir %top-srcdir)
|
||||
(((? valid? files) ...)
|
||||
;; Both subdirs and files must be included.
|
||||
(let ((expected '("libguile" "README" "COPYING"
|
||||
"test-suite" "Makefile.am"
|
||||
"." "..")))
|
||||
(lset= string=?
|
||||
(lset-intersection string=? files expected)
|
||||
expected))))))
|
||||
|
||||
(pass-if "test-suite"
|
||||
(let ((select? (cut string-suffix? ".test" <>)))
|
||||
(match (scandir (string-append %test-dir "/tests") select?)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue