diff options
| author | David Elsing <david.elsing@posteo.net> | 2026-02-03 21:33:21 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-02-10 23:46:34 +0100 |
| commit | 96bd7262777f7f67cdd83c28171425f6bbcf3d50 (patch) | |
| tree | f345bfe791ee6c9cf00d2a639dee8bdfcc12ffcd /tests | |
| parent | 7d1b86859b84d8af0ad9a21648be431d169f216f (diff) | |
gexp: Add 'delayed-object'.
* guix/gexp.scm (<delayed-object>): New record type.
(delayed-object): New macro.
(delayed-object-compiler): New gexp compiler.
* tests/gexp.scm ("delayed-object"): New test.
* doc/guix.texi (G-Expressions): Document it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/gexp.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/gexp.scm b/tests/gexp.scm index 3622324a153..bba8c141f63 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014-2025 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2014-2025 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be> | 3 | ;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be> |
| 4 | ;;; Copyright © 2026 David Elsing <david.elsing@posteo.net> | ||
| 4 | ;;; | 5 | ;;; |
| 5 | ;;; This file is part of GNU Guix. | 6 | ;;; This file is part of GNU Guix. |
| 6 | ;;; | 7 | ;;; |
| @@ -518,6 +519,20 @@ | |||
| 518 | (return (and (eq? drv0 result0) | 519 | (return (and (eq? drv0 result0) |
| 519 | (eq? drv1 result1))))) | 520 | (eq? drv1 result1))))) |
| 520 | 521 | ||
| 522 | (test-assertm "delayed-object" | ||
| 523 | (let ((evaluated #f)) | ||
| 524 | (mlet* %store-monad ((drv (package->derivation coreutils)) | ||
| 525 | (obj -> (delayed-object | ||
| 526 | (begin | ||
| 527 | (set! evaluated #t) | ||
| 528 | coreutils))) | ||
| 529 | (first-evaluated -> evaluated) | ||
| 530 | (result (lower-object obj))) | ||
| 531 | (return (and (string=? (derivation-file-name drv) | ||
| 532 | (derivation-file-name result)) | ||
| 533 | (not first-evaluated) | ||
| 534 | evaluated))))) | ||
| 535 | |||
| 521 | (test-assert "with-parameters + file-append" | 536 | (test-assert "with-parameters + file-append" |
| 522 | (let* ((system (match (%current-system) | 537 | (let* ((system (match (%current-system) |
| 523 | ("aarch64-linux" "x86_64-linux") | 538 | ("aarch64-linux" "x86_64-linux") |
