1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-05-25 18:41:54 +02:00

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.
This commit is contained in:
Ludovic Courtès
2016-06-16 00:06:27 +02:00
parent 07c8a98c3b
commit 0687fc9cd9
3 changed files with 37 additions and 8 deletions
+17 -1
View File
@@ -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))))