Improve locale support

This commit is contained in:
Victor Zverovich
2018-11-14 12:07:39 -08:00
parent 1385050e26
commit f2ee988105
11 changed files with 141 additions and 65 deletions
+21
View File
@@ -0,0 +1,21 @@
// Formatting library for C++ - core tests
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#include "fmt/locale.h"
#include "gmock.h"
struct numpunct : std::numpunct<char> {
protected:
char do_thousands_sep() const FMT_OVERRIDE { return '~'; }
};
TEST(LocaleTest, Format) {
std::locale loc;
EXPECT_EQ("1~234~567",
fmt::format(std::locale(loc, new numpunct()), "{:n}", 1234567));
EXPECT_EQ("1,234,567", fmt::format(loc, "{:n}", 1234567));
}