public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-9889] libstdc++: Adjust expected locale-dependent date formats in tests
Date: Wed, 10 Apr 2024 15:24:04 +0000 (GMT)	[thread overview]
Message-ID: <20240410152404.91C7E384641E@sourceware.org> (raw)

https://gcc.gnu.org/g:4decc1062f0f6eb44209d9d5a26a744ffa474648

commit r14-9889-g4decc1062f0f6eb44209d9d5a26a744ffa474648
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Apr 10 13:24:51 2024 +0100

    libstdc++: Adjust expected locale-dependent date formats in tests
    
    The std/time/year_month_day/io.cc test assumes that %x in the fr_FR
    locale is %d/%m/%Y but on FreeBSD it is %d.%m.%Y instead. Make the test
    PASS for either format.
    
    Similarly, 27_io/manipulators/extended/get_time/char/2.cc expects that
    %a in the de_DE locale is "Di" but on FreeBSD it's "Di." with a trailing
    period. Adjust the input string to be "1971 Di." instead of "Di 1971"
    and that way if %a doesn't expect the trailing '.' it simply won't
    extract it from the stream.
    
    This fixes:
    FAIL: std/time/year_month_day/io.cc  -std=gnu++20 execution test
    FAIL: 27_io/manipulators/extended/get_time/char/2.cc  -std=gnu++17 execution test
    
    libstdc++-v3/ChangeLog:
    
            * testsuite/27_io/manipulators/extended/get_time/char/2.cc:
            Adjust input string so that it matches %a with or without a
            trailing period.
            * testsuite/std/time/year_month_day/io.cc: Adjust expected
            format for %x in the fr_FR locale.

Diff:
---
 .../testsuite/27_io/manipulators/extended/get_time/char/2.cc        | 6 +++---
 libstdc++-v3/testsuite/std/time/year_month_day/io.cc                | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/2.cc b/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/2.cc
index 6104349d254..b582967fddc 100644
--- a/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/2.cc
+++ b/libstdc++-v3/testsuite/27_io/manipulators/extended/get_time/char/2.cc
@@ -35,9 +35,9 @@ void test01()
   VERIFY( loc_de != loc_c );
   istringstream iss;
   iss.imbue(loc_de);
-  iss.str("Di 1971");
-  tm time1;
-  iss >> get_time(&time1, "%a %Y");
+  iss.str("1971 Di."); // %a is "Di" on some targets, "Di." on others.
+  tm time1{};
+  iss >> get_time(&time1, "%Y %a");
   VERIFY(time1.tm_wday == 2);
   VERIFY(time1.tm_year == 71);
 }
diff --git a/libstdc++-v3/testsuite/std/time/year_month_day/io.cc b/libstdc++-v3/testsuite/std/time/year_month_day/io.cc
index cb82ef3b612..632b7a0fc2d 100644
--- a/libstdc++-v3/testsuite/std/time/year_month_day/io.cc
+++ b/libstdc++-v3/testsuite/std/time/year_month_day/io.cc
@@ -84,7 +84,7 @@ test_format()
   s = std::format(loc_fr, "{:%x}", 2022y/December/19);
   VERIFY( s == "12/19/22" );
   s = std::format(loc_fr, "{:L%x}", 2022y/December/19);
-  VERIFY( s == "19/12/2022" );
+  VERIFY( s == "19/12/2022" || s == "19.12.2022" ); // depends on locale defs
   s = std::format(loc_fr, "{}", 2022y/December/19);
   VERIFY( s == "2022-12-19" );
   s = std::format(loc_fr, "{:L%F}", 2022y/December/19);

                 reply	other threads:[~2024-04-10 15:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240410152404.91C7E384641E@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).