On Sun, 21 Jan 2024 at 22:27, Jonathan Wakely wrote:
> --- a/libstdc++-v3/testsuite/std/time/clock/file/io.cc
> +++ b/libstdc++-v3/testsuite/std/time/clock/file/io.cc
> @@ -17,6 +17,23 @@ test_ostream()
>    VERIFY( ss1.str() == ss2.str() );
>  }
>
> +void
> +test_format()
> +{
> +  using namespace std::chrono;
> +  auto t = file_clock::now();
> +
> +  auto s = std::format("{}", t);
> +  std::ostringstream ss;
> +  ss << t;
> +  VERIFY( s == ss.str() );
> +
> +  // PR libstdc++/113500
> +  auto ft = clock_cast<file_clock>(sys_days(2024y/January/21)) + 0ms + 2.5s;
> +  s = std::format("{}", ft);
> +  VERIFY( s == "2024-01-17 00:00:02.500");

Well obviously that should be 2024-01-21 and I should add a call to
test_format() in main() so it actually runs.

I'll push this fix:

--- a/libstdc++-v3/testsuite/std/time/clock/file/io.cc
+++ b/libstdc++-v3/testsuite/std/time/clock/file/io.cc
@@ -31,7 +31,7 @@ test_format()
  // PR libstdc++/113500
  auto ft = clock_cast<file_clock>(sys_days(2024y/January/21)) + 0ms + 2.5s;
  s = std::format("{}", ft);
-  VERIFY( s == "2024-01-17 00:00:02.500");
+  VERIFY( s == "2024-01-21 00:00:02.500");
}

void
@@ -54,5 +54,6 @@ test_parse()
int main()
{
  test_ostream();
+  test_format();
  test_parse();
}

Reply via email to