Detect overflow on large precision

This commit is contained in:
Victor Zverovich
2021-12-05 07:26:58 -08:00
parent c240d98ffd
commit 215f21a038
3 changed files with 10 additions and 2 deletions
+3
View File
@@ -934,6 +934,9 @@ TEST(format_test, precision) {
EXPECT_THROW_MSG((void)fmt::format(runtime("{:.{}e}"), 42.0,
fmt::detail::max_value<int>()),
format_error, "number is too big");
EXPECT_THROW_MSG(
(void)fmt::format("{:.2147483646f}", -2.2121295195081227E+304),
format_error, "number is too big");
EXPECT_EQ("st", fmt::format("{0:.2}", "str"));
}