blob: 17cfb817cafa6e4e08197bdc92d4162fd0b6d731 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
(((guile) setenv getenv)
((hnh util) let-env))
(setenv "CALP_TEST_ENV" "1")
(test-equal "Ensure we have set value beforehand"
"1" (getenv "CALP_TEST_ENV"))
(let-env ((CALP_TEST_ENV "2"))
(test-equal "Test our local override"
"2" (getenv "CALP_TEST_ENV")))
(test-equal "Test that we have returned"
"1" (getenv "CALP_TEST_ENV"))
(catch 'test-error
(lambda ()
(let-env ((CALP_TEST_ENV "2"))
(test-equal "Test our local override again"
"2" (getenv "CALP_TEST_ENV"))
(throw 'test-error)))
list)
(test-equal "Test restoration after non-local exit"
"1" (getenv "CALP_TEST_ENV"))
|