From 2e3352fd051e791a452e93a3f85de2e734e11734 Mon Sep 17 00:00:00 2001 From: Paul Dreik Date: Sun, 28 Apr 2019 21:34:09 +0200 Subject: [PATCH] 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. --- test/chrono-test.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/chrono-test.cc b/test/chrono-test.cc index 40d34235..76d93fbf 100644 --- a/test/chrono-test.cc +++ b/test/chrono-test.cc @@ -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