gnucash master: Fix gnc-numeric locale test on travis

Geert Janssens gjanssens at code.gnucash.org
Tue Feb 21 10:50:02 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/7c041eb2 (commit)
	from  https://github.com/Gnucash/gnucash/commit/75e6a41b (commit)



commit 7c041eb28335b53f9ab70a76aaa5aa379c059645
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Tue Feb 21 16:46:31 2017 +0100

    Fix gnc-numeric locale test on travis
    
    - Change locale from de_DE to fr_FR.utf8
    - Expect correct thousands separator
    
    This also partly undoes the previous commit (it removes the
    test for gcc 5 or more)

diff --git a/src/libqof/qof/gnc-numeric.hpp b/src/libqof/qof/gnc-numeric.hpp
index a0bf0c3..d9ff3d7 100644
--- a/src/libqof/qof/gnc-numeric.hpp
+++ b/src/libqof/qof/gnc-numeric.hpp
@@ -350,13 +350,12 @@ std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>&
     std::locale loc = s.getloc();
     ss.imbue(loc);
     char dec_pt = '.';
-#if __GNUC__ >= 5
     try
     {
         dec_pt = std::use_facet<std::numpunct<char>>(loc).decimal_point();
     }
     catch(const std::bad_cast& err) {} //Don't do anything, num_sep is already set.
-#endif
+
     ss.copyfmt(s);
     ss.width(0);
     if (n.denom() == 1)
diff --git a/src/libqof/qof/test/gtest-gnc-numeric.cpp b/src/libqof/qof/test/gtest-gnc-numeric.cpp
index 8aa3aef..a6583e7 100644
--- a/src/libqof/qof/test/gtest-gnc-numeric.cpp
+++ b/src/libqof/qof/test/gtest-gnc-numeric.cpp
@@ -211,18 +211,16 @@ TEST(gncnumeric_stream, output_stream)
     GncNumeric rational_string(123, 456);
     output << rational_string;
     EXPECT_EQ("123/456", output.str());
-#if __GNUC__ >= 5
-    output.imbue(std::locale("de_DE"));
+    output.imbue(std::locale("fr_FR.utf8"));
     output.str("");
     output << simple_int;
-    EXPECT_EQ("123456", output.str());
+    EXPECT_EQ("123 456", output.str());
     output.str("");
     output << decimal_string;
     EXPECT_EQ("123,456", output.str());
     output.str("");
     output << rational_string;
     EXPECT_EQ("123/456", output.str());
-#endif
 }
 
 TEST(gncnumeric_stream, input_stream)



Summary of changes:
 src/libqof/qof/gnc-numeric.hpp            | 3 +--
 src/libqof/qof/test/gtest-gnc-numeric.cpp | 6 ++----
 2 files changed, 3 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list