From: Tom Honermann <tom@honermann.net>
To: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>,
gcc-patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH 3/4]: C++ P1423R3 char8_t remediation: Updates to existing tests
Date: Sun, 15 Sep 2019 19:39:00 -0000 [thread overview]
Message-ID: <e5c97e9c-aae2-3fae-db13-9341b2962e66@honermann.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 810 bytes --]
This patch updates existing tests to validate the new value for the
__cpp_lib_char8_t feature test macros and to exercise u8path factory
function invocations with std::string, std::string_view, and interator
pair arguments.
libstdc++-v3/ChangeLog:
2019-09-15 Tom Honermann <tom@honermann.net>
* libstdc++-v3/testsuite/experimental/feat-char8_t.cc: Updated the
expected __cpp_lib_char8_t feature test macro value.
* libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc:
Added testing of u8path invocation with std::string,
std::string_view, and iterators thereof.
*
libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path.cc:
Added testing of u8path invocation with std::string,
std::string_view, and iterators thereof.
Tom.
[-- Attachment #2: p1423r3-3.patch --]
[-- Type: text/x-patch, Size: 2259 bytes --]
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc
index aff722b5867..fb337ce1284 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc
@@ -19,6 +19,7 @@
// { dg-do run { target c++17 } }
#include <filesystem>
+#include <string_view>
#include <testsuite_hooks.h>
namespace fs = std::filesystem;
@@ -34,6 +35,22 @@ test01()
p = fs::u8path("\xf0\x9d\x84\x9e");
VERIFY( p.u8string() == u8"\U0001D11E" );
+
+ std::string s1 = "filename2";
+ p = fs::u8path(s1);
+ VERIFY( p.u8string() == u8"filename2" );
+
+ std::string s2 = "filename3";
+ p = fs::u8path(s2.begin(), s2.end());
+ VERIFY( p.u8string() == u8"filename3" );
+
+ std::string_view sv1{ s1 };
+ p = fs::u8path(sv1);
+ VERIFY( p.u8string() == u8"filename2" );
+
+ std::string_view sv2{ s2 };
+ p = fs::u8path(sv2.begin(), sv2.end());
+ VERIFY( p.u8string() == u8"filename3" );
}
void
diff --git a/libstdc++-v3/testsuite/experimental/feat-char8_t.cc b/libstdc++-v3/testsuite/experimental/feat-char8_t.cc
index e843604266c..c9b277a4626 100644
--- a/libstdc++-v3/testsuite/experimental/feat-char8_t.cc
+++ b/libstdc++-v3/testsuite/experimental/feat-char8_t.cc
@@ -12,6 +12,6 @@
#ifndef __cpp_lib_char8_t
# error "__cpp_lib_char8_t"
-#elif __cpp_lib_char8_t != 201811L
-# error "__cpp_lib_char8_t != 201811L"
+#elif __cpp_lib_char8_t != 201907L
+# error "__cpp_lib_char8_t != 201907L"
#endif
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path.cc
index bdeb3946a15..83219b7ddda 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path.cc
@@ -35,6 +35,14 @@ test01()
p = fs::u8path("\xf0\x9d\x84\x9e");
VERIFY( p.u8string() == u8"\U0001D11E" );
+
+ std::string s1 = "filename2";
+ p = fs::u8path(s1);
+ VERIFY( p.u8string() == u8"filename2" );
+
+ std::string s2 = "filename3";
+ p = fs::u8path(s2.begin(), s2.end());
+ VERIFY( p.u8string() == u8"filename3" );
}
void
reply other threads:[~2019-09-15 19:39 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=e5c97e9c-aae2-3fae-db13-9341b2962e66@honermann.net \
--to=tom@honermann.net \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@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).