diff options
author | zimoun <zimon.toutoune@gmail.com> | 2020-05-03 17:01:53 +0200 |
---|---|---|
committer | Guix Patches Tester <> | 2020-05-03 16:06:10 +0100 |
commit | b333c77da7fb4dae4059d0acdddd5938128d0c2e (patch) | |
tree | c4135e0cf7acdba80e2dc8f723daabab43339776 /tests/packages.scm | |
parent | 2f56e3e67d7f2744c5eca39cb87adb9c77271110 (diff) | |
download | guix-patches-b333c77da7fb4dae4059d0acdddd5938128d0c2e.tar guix-patches-b333c77da7fb4dae4059d0acdddd5938128d0c2e.tar.gz |
DRAFT packages: Add new procedure 'fold-packages*'.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r-- | tests/packages.scm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm index 7a8b5e4a2d..4504f6cf33 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1169,6 +1169,37 @@ ((one) (eq? one guile-2.0)))) +(test-assert "fold-packages* hello with/without cache" + (let () + (define (equal-package? p1 p2) + ;; fold-package* re-constructs a new package skipping 'source' and 'lower' + ;; so equal? does not apply + (and (equal? (package-full-name p1) (package-full-name p2)) + (equal? (package-description p1) (package-description p2)))) + + (define no-cache + (fold-packages* (lambda (p r) + (if (string=? (package-name p) "hello") + p + r)) + #f)) + + (define from-cache + (call-with-temporary-directory + (lambda (cache) + (generate-package-cache cache) + (mock ((guix describe) current-profile (const cache)) + (mock ((gnu packages) cache-is-authoritative? (const #t)) + (fold-packages* (lambda (p r) + (if (string=? (package-name p) "hello") + p + r)) + #f)))))) + + (and (equal? no-cache hello) + (equal-package? from-cache hello) + (equal-package? no-cache from-cache)))) + (test-assert "fold-available-packages with/without cache" (let () (define no-cache |