Adjust locale test so that it works on both Ubuntu and MacOS.

This commit is contained in:
John Ralls 2017-03-14 21:26:20 -07:00
parent f795d7ff59
commit 3cb044c8fc

View File

@ -211,10 +211,20 @@ TEST(gncnumeric_stream, output_stream)
GncNumeric rational_string(123, 456); GncNumeric rational_string(123, 456);
output << rational_string; output << rational_string;
EXPECT_EQ("123/456", output.str()); EXPECT_EQ("123/456", output.str());
output.imbue(std::locale("fr_FR.utf8")); try
output.str(""); {
output << simple_int; output.imbue(std::locale("fr_FR.utf8"));
EXPECT_EQ("123 456", output.str()); output.str("");
output << simple_int;
EXPECT_EQ("123 456", output.str());
}
catch (std::runtime_error)
{
output.imbue(std::locale("fr_FR"));
output.str("");
output << simple_int;
EXPECT_EQ("123456", output.str());
}
output.str(""); output.str("");
output << decimal_string; output << decimal_string;
EXPECT_EQ("123,456", output.str()); EXPECT_EQ("123,456", output.str());