Make the 'n' format specifier work with grisu disabled

This commit is contained in:
Victor Zverovich
2019-07-04 15:15:14 -07:00
parent bc628f8d49
commit 1d3e3d8c04
4 changed files with 37 additions and 17 deletions
+7
View File
@@ -18,6 +18,13 @@ template <typename Char> struct numpunct : std::numpunct<Char> {
TEST(LocaleTest, DoubleDecimalPoint) {
std::locale loc(std::locale(), new numpunct<char>());
EXPECT_EQ("1?23", fmt::format(loc, "{:n}", 1.23));
// Test with Grisu disabled.
fmt::memory_buffer buf;
fmt::internal::writer w(buf, fmt::internal::locale_ref(loc));
auto specs = fmt::format_specs();
specs.type = 'n';
w.write_double<double, false>(1.23, specs);
EXPECT_EQ(fmt::to_string(buf), "1?23");
}
TEST(LocaleTest, Format) {