mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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'.
This commit is contained in:
parent
0848615300
commit
22f95e028f
3 changed files with 30 additions and 26 deletions
|
@ -39,6 +39,8 @@
|
|||
canonical-file?
|
||||
network-reachable?
|
||||
shebang-too-long?
|
||||
with-environment-variable
|
||||
|
||||
mock
|
||||
%test-substitute-urls
|
||||
test-assertm
|
||||
|
@ -195,6 +197,19 @@ store is opened."
|
|||
(run-with-store store exp
|
||||
#:guile-for-build (%guile-for-build)))))
|
||||
|
||||
(define-syntax-rule (with-environment-variable variable value body ...)
|
||||
"Run BODY with VARIABLE set to VALUE."
|
||||
(let ((orig (getenv variable)))
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
(setenv variable value))
|
||||
(lambda ()
|
||||
body ...)
|
||||
(lambda ()
|
||||
(if orig
|
||||
(setenv variable orig)
|
||||
(unsetenv variable))))))
|
||||
|
||||
|
||||
;;;
|
||||
;;; Narinfo files, as used by the substituter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue