mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Improve API safety
This commit is contained in:
@ -442,8 +442,8 @@ TEST(locale_test, format) {
|
||||
EXPECT_EQ("1~234~567", fmt::format(loc, "{:L}", 1234567));
|
||||
EXPECT_EQ("-1~234~567", fmt::format(loc, "{:L}", -1234567));
|
||||
EXPECT_EQ("-256", fmt::format(loc, "{:L}", -256));
|
||||
fmt::format_arg_store<fmt::format_context, int> as{1234567};
|
||||
EXPECT_EQ("1~234~567", fmt::vformat(loc, "{:L}", fmt::format_args(as)));
|
||||
auto n = 1234567;
|
||||
EXPECT_EQ("1~234~567", fmt::vformat(loc, "{:L}", fmt::make_format_args(n)));
|
||||
auto s = std::string();
|
||||
fmt::format_to(std::back_inserter(s), loc, "{:L}", 1234567);
|
||||
EXPECT_EQ("1~234~567", s);
|
||||
@ -477,9 +477,9 @@ TEST(locale_test, wformat) {
|
||||
EXPECT_EQ(L"1234567", fmt::format(std::locale(), L"{:L}", 1234567));
|
||||
EXPECT_EQ(L"1~234~567", fmt::format(loc, L"{:L}", 1234567));
|
||||
using wcontext = fmt::buffer_context<wchar_t>;
|
||||
fmt::format_arg_store<wcontext, int> as{1234567};
|
||||
int n = 1234567;
|
||||
EXPECT_EQ(L"1~234~567",
|
||||
fmt::vformat(loc, L"{:L}", fmt::basic_format_args<wcontext>(as)));
|
||||
fmt::vformat(loc, L"{:L}", fmt::make_wformat_args(n)));
|
||||
EXPECT_EQ(L"1234567", fmt::format(std::locale("C"), L"{:L}", 1234567));
|
||||
|
||||
auto no_grouping_loc = std::locale(std::locale(), new no_grouping<wchar_t>());
|
||||
|
Reference in New Issue
Block a user