provoke assertion

fmt/include/fmt/core.h:246:
typename std::make_unsigned<_Tp>::type fmt::v5::internal::to_unsigned(Int)
[with Int = long int;
 typename std::make_unsigned<_Tp>::type = long unsigned int]:
Assertion `(value >= 0) && "negative value"' failed.
This commit is contained in:
Paul Dreik 2019-04-28 21:34:09 +02:00
parent 134904c886
commit 2e3352fd05

View File

@ -296,4 +296,13 @@ TEST(ChronoTest, FormatFullSpecsQq) {
EXPECT_EQ("*1.2340 ms*", fmt::format("{:*^11.4%Q %q}", dms(1.234)));
}
TEST(ChronoTest, InvalidWidthId) {
EXPECT_THROW(fmt::format("{:{o}", std::chrono::seconds(0)),
fmt::format_error);
}
TEST(ChronoTest, InvalidColons) {
EXPECT_THROW(fmt::format("{0}=:{0::", std::chrono::seconds(0)),
fmt::format_error);
}
#endif // FMT_STATIC_THOUSANDS_SEPARATOR