Minor improvements to Filesystem tests
authorJonathan Wakely <jwakely@redhat.com>
Wed, 15 Nov 2017 18:22:43 +0000 (18:22 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 15 Nov 2017 18:22:43 +0000 (18:22 +0000)
* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave
error_code unset.
* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
Check for past-the-end before dereferencing.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: Likewise.

From-SVN: r254781

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc
libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc
libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc

index 5f0bcca83be636a1e65a52301d6066dde9b689e9..701131770746560e8f77e8f365249d031c300a00 100644 (file)
@@ -1,5 +1,12 @@
 2017-11-15  Jonathan Wakely  <jwakely@redhat.com>
 
+       * testsuite/27_io/filesystem/iterators/directory_iterator.cc: Leave
+       error_code unset.
+       * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
+       Check for past-the-end before dereferencing.
+       * testsuite/experimental/filesystem/iterators/
+       recursive_directory_iterator.cc: Likewise.
+
        * include/bits/range_access.h (size, empty, data): Add conditional
        noexcept to generic overloads.
 
index c3e6f01670aeb50c36776d2910d90f99130cf389..9cdbd7aafa045cb6497ee977d262ab9e72228e8a 100644 (file)
@@ -61,7 +61,6 @@ test01()
   ec = bad_ec;
   permissions(p, fs::perms::none, ec);
   VERIFY( !ec );
-  ec = bad_ec;
   iter = fs::directory_iterator(p, ec);
   VERIFY( ec );
   VERIFY( iter == end(iter) );
index 1ef450fc9072997beaf8a28c36e80cf8fd35aa69..d41a1506d3b9c0711e49612de52ea4e778ef389f 100644 (file)
@@ -87,6 +87,7 @@ test01()
   VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1" );
   ++iter;              // should recurse into d1
+  VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1/d2" );
   iter.increment(ec);  // should fail to recurse into p/d1/d2
   VERIFY( ec );
@@ -99,6 +100,7 @@ test01()
   VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1" );
   ++iter;              // should recurse into d1
+  VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1/d2" );
   ec = bad_ec;
   iter.increment(ec);  // should fail to recurse into p/d1/d2, so skip it
index 50cc7d45de862dc0f9116e0979c738326d3267cc..584cfeed839c911b21d920707cf0399ffd797105 100644 (file)
@@ -56,6 +56,7 @@ test01()
   VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1" );
   ++iter;
+  VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1/d2" );
   ++iter;
   VERIFY( iter == end(iter) );
@@ -88,6 +89,7 @@ test01()
   VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1" );
   ++iter;              // should recurse into d1
+  VERIFY( iter != end(iter) );
   VERIFY( iter->path() == p/"d1/d2" );
   iter.increment(ec);  // should fail to recurse into p/d1/d2
   VERIFY( ec );