guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 02/02: i18n: locale-positive-separated-by-space? should


From: Mike Gran
Subject: [Guile-commits] 02/02: i18n: locale-positive-separated-by-space? should return bool, not string
Date: Mon, 20 Mar 2017 23:35:00 -0400 (EDT)

mike121 pushed a commit to branch master
in repository guile.

commit dc9d1474aa03e73a093f3c9447006549d6576c2f
Author: Mike Gran <address@hidden>
Date:   Mon Mar 20 20:29:21 2017 -0700

    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
---
 libguile/i18n.c            | 13 +++++++++----
 test-suite/tests/i18n.test | 12 ++++++++++++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/libguile/i18n.c b/libguile/i18n.c
index 6f75966..47179d1 100644
--- a/libguile/i18n.c
+++ b/libguile/i18n.c
@@ -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;
diff --git a/test-suite/tests/i18n.test b/test-suite/tests/i18n.test
index 478a0c3..a206511 100644
--- a/test-suite/tests/i18n.test
+++ b/test-suite/tests/i18n.test
@@ -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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]