Skip to content

Commit

Permalink
Use a more extreme case to ensure test failure on all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
cschreib committed Nov 24, 2023
1 parent b9174d3 commit 4694df5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/chrono-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,9 @@ TEST(chrono_test, timestamps_ratios) {
EXPECT_EQ(fmt::format("{:%Y-%m-%d}", t5), "3000-01-01");

#if FMT_SAFE_DURATION_CAST
std::chrono::time_point<std::chrono::system_clock, std::chrono::hours> t6(
(std::chrono::hours(std::numeric_limits<std::int64_t>::max())));
using years = std::chrono::duration<std::int64_t, std::ratio<31556952>>;
std::chrono::time_point<std::chrono::system_clock, years> t6(
(years(std::numeric_limits<std::int64_t>::max())));

EXPECT_THROW_MSG((void)fmt::format("{:%Y-%m-%d}", t6), fmt::format_error,
"cannot format duration");
Expand Down

0 comments on commit 4694df5

Please sign in to comment.