summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-06-16 00:06:27 +0200
committerLudovic Courtès <ludo@gnu.org>2016-06-16 09:34:32 +0200
commit0687fc9cd98e38feab80e2f9c8044e77ad52c7fd (patch)
treed7e4b82bb0325a433a0d6e5123297b9459291825 /tests
parent07c8a98c3b45dca9fd36af7c4a300d3af58734dd (diff)
gexp: Add #:select? parameter to 'local-file'.
* guix/gexp.scm (<local-file>)[select?]: New field. (true): New procedure. (%local-file): Add #:select? and honor it. (local-file): Likewise. * tests/gexp.scm ("local-file, #:select?"): New test. * doc/guix.texi (G-Expressions): Adjust accordingly.
Diffstat (limited to 'tests')
-rw-r--r--tests/gexp.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm
index db0ffd2fdd..f504b92d84 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -33,7 +33,8 @@
#:use-module (rnrs io ports)
#:use-module (ice-9 match)
#:use-module (ice-9 regex)
- #:use-module (ice-9 popen))
+ #:use-module (ice-9 popen)
+ #:use-module (ice-9 ftw))
;; Test the (guix gexp) module.
@@ -132,6 +133,21 @@
(lambda ()
(false-if-exception (delete-file link))))))
+(test-assertm "local-file, #:select?"
+ (mlet* %store-monad ((select? -> (lambda (file stat)
+ (member (basename file)
+ '("guix.scm" "tests"
+ "gexp.scm"))))
+ (file -> (local-file ".." "directory"
+ #:recursive? #t
+ #:select? select?))
+ (dir (lower-object file)))
+ (return (and (store-path? dir)
+ (equal? (scandir dir)
+ '("." ".." "guix.scm" "tests"))
+ (equal? (scandir (string-append dir "/tests"))
+ '("." ".." "gexp.scm"))))))
+
(test-assert "one plain file"
(let* ((file (plain-file "hi" "Hello, world!"))
(exp (gexp (display (ungexp file))))