libstdc++: P1423R3 char8_t remediation (3/4)
authorTom Honermann <tom@honermann.net>
Fri, 29 Nov 2019 17:43:46 +0000 (17:43 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 29 Nov 2019 17:43:46 +0000 (17:43 +0000)
Updates to existing tests

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.

2019-11-29  Tom Honermann  <tom@honermann.net>

Updates to existing tests
* testsuite/experimental/feat-char8_t.cc: Updated the expected
__cpp_lib_char8_t feature test macro value.
* testsuite/27_io/filesystem/path/factory/u8path.cc: Added testing of
u8path invocation with std::string, std::string_view, and iterators
thereof.
* testsuite/experimental/filesystem/path/factory/u8path.cc: Added
testing of u8path invocation with std::string, std::string_view, and
iterators thereof.

From-SVN: r278857

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc
libstdc++-v3/testsuite/experimental/feat-char8_t.cc
libstdc++-v3/testsuite/experimental/filesystem/path/factory/u8path.cc

index 8233ecdce3c65ac300513ffc1f9ee06440cd892e..b7b11ecde282441938e0654f4879b3b250b34af0 100644 (file)
@@ -1,5 +1,15 @@
 2019-11-29  Tom Honermann  <tom@honermann.net>
 
+       Updates to existing tests
+       * testsuite/experimental/feat-char8_t.cc: Updated the expected
+       __cpp_lib_char8_t feature test macro value.
+       * testsuite/27_io/filesystem/path/factory/u8path.cc: Added testing of
+       u8path invocation with std::string, std::string_view, and iterators
+       thereof.
+       * testsuite/experimental/filesystem/path/factory/u8path.cc: Added
+       testing of u8path invocation with std::string, std::string_view, and
+       iterators thereof.
+
        Update feature test macro, add deleted operators, update u8path
        * include/bits/c++config: Bumped the value of the __cpp_lib_char8_t
        feature test macro.
index aff722b586758c6cc163c64ea558add87952d006..fb337ce1284ee54f9286e3f2d1da78bff04dfaac 100644 (file)
@@ -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
index e843604266c99c28788ab0734e2e6f5676241709..c9b277a462668af05817793fd0f4e420a7356731 100644 (file)
@@ -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
index bdeb3946a15f677aa2286b7ce6f03fb0dc70e2c6..83219b7dddaf4fea2cac4d6071724f17232eb89d 100644 (file)
@@ -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