Fix a libc++ warning and move the test to the right place

This commit is contained in:
Victor Zverovich
2023-11-25 08:20:53 -08:00
parent c3f9a73445
commit c4283ec471
3 changed files with 10 additions and 19 deletions
+10
View File
@@ -173,6 +173,10 @@ TEST(util_test, parse_nonnegative_int) {
EXPECT_EQ(fmt::detail::parse_nonnegative_int(begin, end, -1), -1);
}
TEST(format_impl_test, compute_width) {
EXPECT_EQ(fmt::detail::compute_width("вожык"), 5);
}
TEST(util_test, utf8_to_utf16) {
auto u = fmt::detail::utf8_to_utf16("лошадка");
EXPECT_EQ(L"\x043B\x043E\x0448\x0430\x0434\x043A\x0430", u.str());
@@ -1053,6 +1057,12 @@ TEST(format_test, precision) {
EXPECT_EQ("123456", fmt::format("{0:.6}", "123456\xad"));
}
TEST(xchar_test, utf8_precision) {
auto result = fmt::format("{:.4}", "caf\u00e9s"); // cafés
EXPECT_EQ(fmt::detail::compute_width(result), 4);
EXPECT_EQ(result, "caf\u00e9");
}
TEST(format_test, runtime_precision) {
char format_str[buffer_size];
safe_sprintf(format_str, "{0:.{%u", UINT_MAX);