diff mbox

Add recursive_directory_iterator::pop(error_code&)

Message ID 20161026153427.GW2922@redhat.com
State New
Headers show

Commit Message

Jonathan Wakely Oct. 26, 2016, 3:34 p.m. UTC
On 26/10/16 16:19 +0100, Jonathan Wakely wrote:
>Another Filesystem TS change, implementing LWG 2706.

>

>	* include/experimental/bits/fs_dir.h (recursive_directory_iterator):

>	Overload pop (LWG 2706).

>	* src/filesystem/dir.cc (recursive_directory_iterator::pop): Define

>	new overload.

>	* testsuite/experimental/filesystem/iterators/pop.cc: New test.

>


This new test isn't reliable, it depends on directory order. This
simplifies it so it behaves reliably.

Committed to trunk.
diff mbox

Patch

commit a16b18039731f450dfb4a8c4fff8db8b8da41817
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 26 16:31:19 2016 +0100

    Fix test for recursive_directory_iterator::pop
    
    	* testsuite/experimental/filesystem/iterators/pop.cc: Remove
    	unreliable dependency on directory order.

diff --git a/libstdc++-v3/testsuite/experimental/filesystem/iterators/pop.cc b/libstdc++-v3/testsuite/experimental/filesystem/iterators/pop.cc
index fa1ae62..d247ab4 100644
--- a/libstdc++-v3/testsuite/experimental/filesystem/iterators/pop.cc
+++ b/libstdc++-v3/testsuite/experimental/filesystem/iterators/pop.cc
@@ -78,13 +78,11 @@  test03()
   create_directories(p / "d1/d2/d3");
   create_directories(p / "d1/d2/e3");
   create_directories(p / "d1/e2/d3");
-  create_directories(p / "e1");
-  __gnu_test::scoped_file f(p / "d1/d2/d3/f");
-  for (int i = 0; i < 4; ++i)
+  for (int i = 0; i < 3; ++i)
   {
     fs::recursive_directory_iterator dir(p);
     std::advance(dir, i);
-    int expected_depth = std::min(i, 3); // fourth entry is a file, not dir
+    int expected_depth = i;
     VERIFY( dir.depth() == expected_depth );
     __builtin_printf("%d %d %s\n", i, dir.depth(), dir->path().c_str());
     dir.pop(ec);
@@ -102,7 +100,6 @@  test03()
     if (dir != end(dir))
       VERIFY( dir.depth() == (i -1) );
   }
-  f.path.clear();
   remove_all(p, ec);
 }