[gcc/devel/omp/gcc-9] Fix filesystem::path tests

Tobias Burnus burnus@gcc.gnu.org
Thu Mar 5 13:49:00 GMT 2020


https://gcc.gnu.org/g:aa5005a56c6b50852400654440ea64e8bfae7e3a

commit aa5005a56c6b50852400654440ea64e8bfae7e3a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed May 15 20:38:42 2019 +0100

    Fix filesystem::path tests
    
    The root_path.cc test had some debugging macros left in accidentally, so
    didn't FAIL correctly if an assertion failed.
    
    The string-char8_t.cc tests didn't compile on Windows.
    
    Backport from mainline
    2019-04-30  Jonathan Wakely  <jwakely@redhat.com>
    
    	* testsuite/27_io/filesystem/path/decompose/root_path.cc: Remove
    	macros accidentally left in.
    	* testsuite/27_io/filesystem/path/native/string-char8_t.cc: Remove
    	unnecessary -lstdc++fs option. Fix test for mingw.
    	* testsuite/experimental/filesystem/path/native/string-char8_t.cc:
    	Fix test for mingw.
    
    From-SVN: r271263

Diff:
---
 libstdc++-v3/ChangeLog                                         | 10 ++++++++++
 .../testsuite/27_io/filesystem/path/decompose/root_path.cc     |  5 -----
 .../testsuite/27_io/filesystem/path/native/string-char8_t.cc   |  9 +++++----
 .../experimental/filesystem/path/native/string-char8_t.cc      |  7 ++++---
 4 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index a1ff4a0..a658eb2 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,6 +1,16 @@
 2019-05-15  Jonathan Wakely  <jwakely@redhat.com>
 
 	Backport from mainline
+	2019-04-30  Jonathan Wakely  <jwakely@redhat.com>
+
+	* testsuite/27_io/filesystem/path/decompose/root_path.cc: Remove
+	macros accidentally left in.
+	* testsuite/27_io/filesystem/path/native/string-char8_t.cc: Remove
+	unnecessary -lstdc++fs option. Fix test for mingw.
+	* testsuite/experimental/filesystem/path/native/string-char8_t.cc:
+	Fix test for mingw.
+
+	Backport from mainline
 	2019-05-13  Jonathan Wakely  <jwakely@redhat.com>
 
 	PR libstdc++/90454.cc path construction from void*
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc
index 4f4c531..d573b48 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/root_path.cc
@@ -35,10 +35,6 @@ test01()
   VERIFY( p2.root_path() == path("/") );
 }
 
-#undef VERIFY
-#define VERIFY(X) do { if (!(X)) { __builtin_puts("FAIL: " #X); } } while(false)
-#define DUMP(X, Y, Z) do { if (!(Y == Z)) { __builtin_printf("%s %s %s\n", X.c_str(), Y.c_str(), Z.c_str()); } } while(false)
-
 void
 test02()
 {
@@ -48,7 +44,6 @@ test02()
     path rootn = p.root_name();
     path rootd = p.root_directory();
     VERIFY( rootp == (rootn / rootd) );
-    DUMP(p,  rootp , (rootn / rootd) );
   }
 }
 
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
index f5bb1af..d333787 100644
--- a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
@@ -15,7 +15,7 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=gnu++17 -lstdc++fs -fchar8_t" }
+// { dg-options "-std=gnu++17 -fchar8_t" }
 // { dg-do run { target c++17 } }
 // { dg-require-filesystem-ts "" }
 
@@ -27,14 +27,15 @@ void
 test01()
 {
   using namespace std::filesystem;
-  const std::string s = "abc";
+  using string_type = std::basic_string<path::value_type>;
+  const string_type s{ 'a', 'b', 'c' };
   path p(s);
 
   VERIFY( p.native() == s );
   VERIFY( p.c_str() == s );
-  VERIFY( static_cast<std::string>(p) == s );
+  VERIFY( static_cast<string_type>(p) == s );
 
-  std::string s2 = p; // implicit conversion
+  string_type s2 = p; // implicit conversion
   VERIFY( s2 == p.native() );
 }
 
diff --git a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc
index a0d8058..091663f4 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/path/native/string-char8_t.cc
@@ -27,14 +27,15 @@ void
 test01()
 {
   using namespace std::experimental::filesystem;
-  const std::string s = "abc";
+  using string_type = std::basic_string<path::value_type>;
+  const string_type s{ 'a', 'b', 'c' };
   path p(s);
 
   VERIFY( p.native() == s );
   VERIFY( p.c_str() == s );
-  VERIFY( static_cast<std::string>(p) == s );
+  VERIFY( static_cast<string_type>(p) == s );
 
-  std::string s2 = p; // implicit conversion
+  string_type s2 = p; // implicit conversion
   VERIFY( s2 == p.native() );
 }



More information about the Libstdc++-cvs mailing list