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 db0ffd2fdd6..f504b92d841 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -33,7 +33,8 @@
33 #:use-module (rnrs io ports) 33 #:use-module (rnrs io ports)
34 #:use-module (ice-9 match) 34 #:use-module (ice-9 match)
35 #:use-module (ice-9 regex) 35 #:use-module (ice-9 regex)
36 #:use-module (ice-9 popen)) 36 #:use-module (ice-9 popen)
37 #:use-module (ice-9 ftw))
37 38
38;; Test the (guix gexp) module. 39;; Test the (guix gexp) module.
39 40
@@ -132,6 +133,21 @@
132 (lambda () 133 (lambda ()
133 (false-if-exception (delete-file link)))))) 134 (false-if-exception (delete-file link))))))
134 135
136(test-assertm "local-file, #:select?"
137 (mlet* %store-monad ((select? -> (lambda (file stat)
138 (member (basename file)
139 '("guix.scm" "tests"
140 "gexp.scm"))))
141 (file -> (local-file ".." "directory"
142 #:recursive? #t
143 #:select? select?))
144 (dir (lower-object file)))
145 (return (and (store-path? dir)
146 (equal? (scandir dir)
147 '("." ".." "guix.scm" "tests"))
148 (equal? (scandir (string-append dir "/tests"))
149 '("." ".." "gexp.scm"))))))
150
135(test-assert "one plain file" 151(test-assert "one plain file"
136 (let* ((file (plain-file "hi" "Hello, world!")) 152 (let* ((file (plain-file "hi" "Hello, world!"))
137 (exp (gexp (display (ungexp file)))) 153 (exp (gexp (display (ungexp file))))