summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-11-19 22:37:50 +0100
committerLudovic Courtès <ludo@gnu.org>2012-11-19 23:04:38 +0100
commitba326ce41b5784f3acb99d4beae5ffc455d6a27e (patch)
treeafaf50cb0b948f6a49cc0e2c7430fdab915a2f2c /tests
parent733b4130d75281a0bd634bc84600bcc2ea44a317 (diff)
downloadguix-ba326ce41b5784f3acb99d4beae5ffc455d6a27e.tar.gz
distro: Add `fold-packages'.
* distro.scm (fold-packages): New procedure.
  (find-packages-by-name): Use it instead of hand-written traversal;
  remove `package?' checks from `right-package?'.
* tests/packages.scm ("fold-packages"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 29ea691e9f..cb69e4be4e 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -120,6 +120,13 @@
            (and (build-derivations %store (list drv))
                 (file-exists? (string-append out "/bin/make")))))))
 
+(test-eq "fold-packages" hello
+  (fold-packages (lambda (p r)
+                   (if (string=? (package-name p) "hello")
+                       p
+                       r))
+                 #f))
+
 (test-assert "find-packages-by-name"
   (match (find-packages-by-name "hello")
     (((? (cut eq? hello <>))) #t)
@@ -136,6 +143,7 @@
 (exit (= (test-runner-fail-count (test-runner-current)) 0))
 
 ;;; Local Variables:
+;;; eval: (put 'test-equal 'scheme-indent-function 2)
 ;;; eval: (put 'test-assert 'scheme-indent-function 1)
 ;;; eval: (put 'dummy-package 'scheme-indent-function 1)
 ;;; End: