1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix with-locale*' in (test-suite lib)'.

* test-suite/lib.scm (with-locale*): Set LOC to the previous locale
  name, not to the new locale name.  Only restore LOC when it's not #f.
  (with-locale): Use `syntax-rules'.
This commit is contained in:
Ludovic Courtès 2010-03-03 23:57:50 +01:00
parent 54096be752
commit f5147c84a2

View file

@ -456,19 +456,21 @@ with-locale with-locale*
(lambda () (lambda ()
(if (defined? 'setlocale) (if (defined? 'setlocale)
(begin (begin
(set! loc (set! loc (false-if-exception (setlocale LC_ALL)))
(false-if-exception (setlocale LC_ALL nloc))) (if (or (not loc)
(if (not loc) (not (false-if-exception (setlocale LC_ALL nloc))))
(throw 'unresolved))) (throw 'unresolved)))
(throw 'unresolved))) (throw 'unresolved)))
thunk thunk
(lambda () (lambda ()
(if (defined? 'setlocale) (if (and (defined? 'setlocale) loc)
(setlocale LC_ALL loc)))))) (setlocale LC_ALL loc))))))
;;; Evaluate BODY... using the given locale. ;;; Evaluate BODY... using the given locale.
(define-macro (with-locale loc . body) (define-syntax with-locale
`(with-locale* ,loc (lambda () ,@body))) (syntax-rules ()
((_ loc body ...)
(with-locale* loc (lambda () body ...)))))
;;;; REPORTERS ;;;; REPORTERS