diff --git a/test/chrono-test.cc b/test/chrono-test.cc index 573606d8dbdf..71a64d462102 100644 --- a/test/chrono-test.cc +++ b/test/chrono-test.cc @@ -314,4 +314,14 @@ TEST(ChronoTest, NegativeDuration) { EXPECT_EQ("-00:01", fmt::format("{:%M:%S}", std::chrono::duration(-1))); } +TEST(ChronoTest, DurationIsFloatNaN) { + const std::chrono::duration d{std::nanf("1")}; + auto ignored=fmt::format("{:%I}",d); +} + +TEST(ChronoTest, DurationIsDoubleNaN) { + const std::chrono::duration d{std::nan("1")}; + auto ignored=fmt::format("{:%I}",d); +} + #endif // FMT_STATIC_THOUSANDS_SEPARATOR