summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/ice-9/ftw.scm2
-rw-r--r--test-suite/tests/ftw.test12
2 files changed, 13 insertions, 1 deletions
diff --git a/module/ice-9/ftw.scm b/module/ice-9/ftw.scm
index eed3eeb19..5f6115427 100644
--- a/module/ice-9/ftw.scm
+++ b/module/ice-9/ftw.scm
@@ -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)
diff --git a/test-suite/tests/ftw.test b/test-suite/tests/ftw.test
index 41c731a7a..fa179d400 100644
--- a/test-suite/tests/ftw.test
+++ b/test-suite/tests/ftw.test
@@ -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?)