diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2019-03-16 15:11:29 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2019-03-16 18:15:09 +0100 |
| commit | 22f95e028f038cee342f455dfc55bd32b804907c (patch) | |
| tree | dade133425c4c41f26ffad0ecad315923db94dee /tests/scripts.scm | |
| parent | 0848615300ec0693b2849e80103a13063fa4b190 (diff) | |
tests: Add 'with-environment-variable'.
* tests/scripts.scm (with-environment-variable): Move to...
* guix/tests.scm (with-environment-variable): ... here.
* tests/build-utils.scm ("wrap-program, one input, multiple calls"):
Use it instead of 'setenv'.
Diffstat (limited to 'tests/scripts.scm')
| -rw-r--r-- | tests/scripts.scm | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/tests/scripts.scm b/tests/scripts.scm index 39017109533..efee271197f 100644 --- a/tests/scripts.scm +++ b/tests/scripts.scm | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2015 Ludovic Courtès <ludo@gnu.org> | 2 | ;;; Copyright © 2015, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; | 3 | ;;; |
| 4 | ;;; This file is part of GNU Guix. | 4 | ;;; This file is part of GNU Guix. |
| 5 | ;;; | 5 | ;;; |
| @@ -25,19 +25,6 @@ | |||
| 25 | 25 | ||
| 26 | ;; Test the (guix scripts) module. | 26 | ;; Test the (guix scripts) module. |
| 27 | 27 | ||
| 28 | (define-syntax-rule (with-environment-variable variable value body ...) | ||
| 29 | "Run BODY with VARIABLE set to VALUE." | ||
| 30 | (let ((orig (getenv variable))) | ||
| 31 | (dynamic-wind | ||
| 32 | (lambda () | ||
| 33 | (setenv variable value)) | ||
| 34 | (lambda () | ||
| 35 | body ...) | ||
| 36 | (lambda () | ||
| 37 | (if orig | ||
| 38 | (setenv variable orig) | ||
| 39 | (unsetenv variable)))))) | ||
| 40 | |||
| 41 | 28 | ||
| 42 | (test-begin "scripts") | 29 | (test-begin "scripts") |
| 43 | 30 | ||
