diff options
author | Ludovic Courtès <ludo@gnu.org> | 2012-11-19 22:37:50 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2012-11-19 23:04:38 +0100 |
commit | ba326ce41b5784f3acb99d4beae5ffc455d6a27e (patch) | |
tree | afaf50cb0b948f6a49cc0e2c7430fdab915a2f2c /tests/packages.scm | |
parent | 733b4130d75281a0bd634bc84600bcc2ea44a317 (diff) | |
download | guix-ba326ce41b5784f3acb99d4beae5ffc455d6a27e.tar guix-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/packages.scm')
-rw-r--r-- | tests/packages.scm | 8 |
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: |