From fcbe4f71ca7ab7f8526bd1643044d204390ec6c2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 6 Dec 2019 23:04:57 +0100 Subject: derivations: Add 'derivation-input-fold'. * guix/derivations.scm (derivation-input-fold): New procedure. (substitution-oracle)[closure]: Rewrite in terms of 'derivation-input-fold'. * tests/derivations.scm ("derivation-input-fold"): New test. --- tests/derivations.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/derivations.scm b/tests/derivations.scm index 6a7fad85b5..ef6cec6c76 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -978,6 +978,24 @@ #:mode (build-mode check)) (list drv dep)))))) +(test-assert "derivation-input-fold" + (let* ((builder (add-text-to-store %store "my-builder.sh" + "echo hello, world > \"$out\"\n" + '())) + (drv1 (derivation %store "foo" + %bash `(,builder) + #:sources `(,%bash ,builder))) + (drv2 (derivation %store "bar" + %bash `(,builder) + #:inputs `((,drv1)) + #:sources `(,%bash ,builder)))) + (equal? (derivation-input-fold (lambda (input result) + (cons (derivation-input-derivation input) + result)) + '() + (list (derivation-input drv2))) + (list drv1 drv2)))) + (test-assert "substitution-oracle and #:substitute? #f" (with-store store (let* ((dep (build-expression->derivation store "dep" -- cgit v1.2.3