summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/experimental/filesystem
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-06-17 23:57:16 +0000
committerEric Fiselier <eric@efcs.ca>2016-06-17 23:57:16 +0000
commit25255013bab5a04d72312c48401ece0860a97712 (patch)
tree2c14713ad5dee94dca507ff7daaad483dd843f35 /libcxx/test/std/experimental/filesystem
parent8fd597881178c94c5c5c06b768a787e84ff724de (diff)
downloadbcm5719-llvm-25255013bab5a04d72312c48401ece0860a97712.tar.gz
bcm5719-llvm-25255013bab5a04d72312c48401ece0860a97712.zip
Fix bugs in recursive_directory_iterator::increment(ec) implementation and tests.
r273060 didn't completely fix the issues in recursive_directory_iterator and the tests. This patch follows up with more fixes * Fix bug where recursive_directory_iterator::increment(ec) did not reset the error code if no failure occurred. * Fix bad assertion in the recursive_directory_iterator::increment(ec) test that would only fire for certain iteration orders. llvm-svn: 273070
Diffstat (limited to 'libcxx/test/std/experimental/filesystem')
-rw-r--r--libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp b/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
index db2fc1533b7..e67fc2f20f6 100644
--- a/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
+++ b/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp
@@ -194,16 +194,24 @@ TEST_CASE(access_denied_on_recursion_test_case)
recursive_directory_iterator it(startDir, SkipEPerm, ec);
TEST_REQUIRE(!ec);
TEST_REQUIRE(it != endIt);
- const path elem = *it;
- if (elem == permDeniedDir) {
- it.increment(ec);
- TEST_REQUIRE(!ec);
- TEST_REQUIRE(it != endIt);
- TEST_CHECK(*it == otherFile);
- } else if (elem == otherFile) {
- it.increment(ec);
- TEST_REQUIRE(!ec);
+
+ bool seenOtherFile = false;
+ if (*it == otherFile) {
+ ++it;
+ seenOtherFile = true;
+ TEST_REQUIRE (it != endIt);
+ }
+ TEST_REQUIRE(*it == permDeniedDir);
+
+ ec = GetTestEC();
+ it.increment(ec);
+ TEST_REQUIRE(!ec);
+
+ if (seenOtherFile) {
TEST_CHECK(it == endIt);
+ } else {
+ TEST_CHECK(it != endIt);
+ TEST_CHECK(*it == otherFile);
}
}
// Test that construction resulting in a "EACCESS" error is not ignored
OpenPOWER on IntegriCloud