Author: koutou
Date: Sun Mar 22 00:57:39 2009
New Revision: 5922
Modified:
trunk/test/test-intl.scm
trunk/test/uim-test-utils-new.scm
Log:
* test/uim-test-utils-new.scm
(uim-test-with-environment-variables): add.
* test/test-intl.scm: use uim-test-with-environment-variables.
Modified: trunk/test/test-intl.scm
==============================================================================
--- trunk/test/test-intl.scm (original)
+++ trunk/test/test-intl.scm Sun Mar 22 00:57:39 2009
@@ -86,19 +86,13 @@
(build-path LC_MESSAGES-dir #`",|domain|.po")
:wait #t)
- (sys-putenv "LANG" lang)
- (sys-putenv "LC_ALL" lang)
- (uim-test-setup)
- (if current-LANG
- (sys-putenv "LANG" current-LANG)
- (sys-unsetenv "LANG"))
- (if current-LC_ALL
- (sys-putenv "LC_ALL" current-LC_ALL)
- (sys-unsetenv "LC_ALL"))))
+ (uim-test-with-environment-variables
+ `(("LANG" . ,lang)
+ ("LC_ALL" . ,lang))
+ uim-test-setup)))
(define (teardown)
(uim-test-teardown)
-
(remove-directory* locale-dir))
(define (test-gettext)
Modified: trunk/test/uim-test-utils-new.scm
==============================================================================
--- trunk/test/uim-test-utils-new.scm (original)
+++ trunk/test/uim-test-utils-new.scm Sun Mar 22 00:57:39 2009
@@ -161,4 +161,21 @@
(define (uim-test-teardown)
(uim-sh-teardown))
+(define (uim-test-with-environment-variables variables thunk)
+ (let ((original-values '()))
+ (for-each (lambda (pair)
+ (let ((name (car pair))
+ (value (cdr pair)))
+ (push! original-values (cons name (sys-getenv name)))
+ (sys-putenv name value)))
+ variables)
+ (thunk)
+ (for-each (lambda (pair)
+ (let ((name (car pair))
+ (value (cdr pair)))
+ (if value
+ (sys-putenv name value)
+ (sys-unsetenv name))))
+ original-values)))
+
(provide "test/uim-test-utils-new")