mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-26 00:21:13 +00:00
Belarusify test
This commit is contained in:
parent
fbb568bce0
commit
779449fd99
@ -18,12 +18,12 @@ using testing::Contains;
|
|||||||
TEST(unicode_test, is_utf8) { EXPECT_TRUE(fmt::detail::is_utf8()); }
|
TEST(unicode_test, is_utf8) { EXPECT_TRUE(fmt::detail::is_utf8()); }
|
||||||
|
|
||||||
TEST(unicode_test, legacy_locale) {
|
TEST(unicode_test, legacy_locale) {
|
||||||
auto loc = get_locale("ru_RU.CP1251", "Russian_Russia.1251");
|
auto loc = get_locale("be_BY.CP1251", "Belarussian_Belarus.1251");
|
||||||
if (loc == std::locale::classic()) return;
|
if (loc == std::locale::classic()) return;
|
||||||
|
|
||||||
auto s = std::string();
|
auto s = std::string();
|
||||||
try {
|
try {
|
||||||
s = fmt::format(loc, "День недели: {:L}", fmt::weekday(1));
|
s = fmt::format(loc, "Дзень тыдня: {:L}", fmt::weekday(1));
|
||||||
} catch (const fmt::format_error& e) {
|
} catch (const fmt::format_error& e) {
|
||||||
// Formatting can fail due to an unsupported encoding.
|
// Formatting can fail due to an unsupported encoding.
|
||||||
fmt::print("Format error: {}\n", e.what());
|
fmt::print("Format error: {}\n", e.what());
|
||||||
@ -38,11 +38,11 @@ TEST(unicode_test, legacy_locale) {
|
|||||||
os << std::put_time(&tm, "%a");
|
os << std::put_time(&tm, "%a");
|
||||||
auto wd = os.str();
|
auto wd = os.str();
|
||||||
if (wd == "??") {
|
if (wd == "??") {
|
||||||
EXPECT_EQ(s, "День недели: ??");
|
EXPECT_EQ(s, "Дзень тыдня: ??");
|
||||||
fmt::print("std::locale gives ?? as a weekday.\n");
|
fmt::print("std::locale gives ?? as a weekday.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
EXPECT_THAT((std::vector<std::string>{"День недели: пн", "День недели: Пн"}),
|
EXPECT_THAT((std::vector<std::string>{"Дзень тыдня: пн", "Дзень тыдня: Пан"}),
|
||||||
Contains(s));
|
Contains(s));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user