mirror of
https://github.com/fmtlib/fmt.git
synced 2025-10-14 23:05:28 +02:00
Add initial support for weekday formatting
This commit is contained in:
@@ -5,7 +5,25 @@
|
||||
//
|
||||
// For the license information refer to format.h.
|
||||
|
||||
#include "fmt/core.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <vector>
|
||||
|
||||
TEST(unicode_test, is_utf8) { EXPECT_TRUE(fmt::detail::is_utf8()); }
|
||||
#include "fmt/chrono.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "util.h" // get_locale
|
||||
|
||||
using testing::Contains;
|
||||
|
||||
TEST(unicode_test, is_utf8) { EXPECT_TRUE(fmt::detail::is_utf8()); }
|
||||
|
||||
TEST(unicode_test, legacy_locale) {
|
||||
auto loc = get_locale("ru_RU.CP1251");
|
||||
if (loc == std::locale::classic()) return;
|
||||
try {
|
||||
EXPECT_THAT(
|
||||
(std::vector<std::string>{"День недели: пн", "День недели: Пн"}),
|
||||
Contains(fmt::format(loc, "День недели: {:L}", fmt::weekday(1))));
|
||||
} catch (const fmt::format_error& e) {
|
||||
// Formatting can fail due to unsupported encoding.
|
||||
fmt::print("Format error: {}\n", e.what());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user