1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

i18n: locale-positive-separated-by-space? should return bool, not string

* libguile/i18n.c (scm_nl_langinfo): unpack INT_P_SEP_BY_SPACE as bool
* test-suite/tests/i18n.test (nl-langinfo et al.): new tests
This commit is contained in:
Mike Gran 2017-03-20 20:29:21 -07:00
parent c818684252
commit dc9d1474aa
2 changed files with 21 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2006-2014 Free Software Foundation, Inc.
/* Copyright (C) 2006-2014, 2017 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -1567,7 +1567,8 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
#if defined P_CS_PRECEDES || defined N_CS_PRECEDES || \
defined INT_P_CS_PRECEDES || defined INT_N_CS_PRECEDES || \
defined P_SEP_BY_SPACE || defined N_SEP_BY_SPACE
defined P_SEP_BY_SPACE || defined N_SEP_BY_SPACE || \
defined INT_P_SEP_BY_SPACE || defined INT_N_SEP_BY_SPACE
#ifdef P_CS_PRECEDES
case P_CS_PRECEDES:
case N_CS_PRECEDES:
@ -1580,8 +1581,12 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
case P_SEP_BY_SPACE:
case N_SEP_BY_SPACE:
#endif
/* This is to be interpreted as a boolean. */
result = scm_from_bool (*c_result);
#ifdef INT_P_SEP_BY_SPACE
case INT_P_SEP_BY_SPACE:
case INT_N_SEP_BY_SPACE:
#endif
/* This is to be interpreted as a boolean. */
result = scm_from_bool (*c_result);
free (c_result);
break;

View file

@ -524,6 +524,18 @@
(else
#f))))))
(pass-if "locale-positive-separated-by-space?"
;; In any locale, this must be a boolean.
(let ((result (locale-positive-separated-by-space? #f)))
(or (eqv? #t result)
(eqv? #f result))))
(pass-if "locale-positive-separated-by-space? (international)"
;; In any locale, this must be a boolean.
(let ((result (locale-positive-separated-by-space? #t)))
(or (eqv? #t result)
(eqv? #f result))))
(pass-if "locale-monetary-grouping"
;; In the C locale, there is no rule for grouping of digits
;; of monetary values.