Skip to content

Commit

Permalink
Fix gnc-numeric locale test on travis
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
gjanssens committed Feb 21, 2017
1 parent 75e6a41 commit 7c041eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/libqof/qof/gnc-numeric.hpp
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/libqof/qof/test/gtest-gnc-numeric.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit 7c041eb

Please sign in to comment.