[llvm] r269488 - [Support][Unittests] Add unittest for recursive_directory_iterator::level()
Bruno Cardoso Lopes via llvm-commits
llvm-commits at lists.llvm.org
Fri May 13 14:31:33 PDT 2016
Author: bruno
Date: Fri May 13 16:31:32 2016
New Revision: 269488
URL: http://llvm.org/viewvc/llvm-project?rev=269488&view=rev
Log:
[Support][Unittests] Add unittest for recursive_directory_iterator::level()
Modified:
llvm/trunk/unittests/Support/Path.cpp
Modified: llvm/trunk/unittests/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Path.cpp?rev=269488&r1=269487&r2=269488&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/Path.cpp (original)
+++ llvm/trunk/unittests/Support/Path.cpp Fri May 13 16:31:32 2016
@@ -716,6 +716,20 @@ TEST_F(FileSystemTest, DirectoryIteratio
ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/recursive/z0/za1"));
ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/recursive/z0"));
ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/recursive"));
+
+ // Test recursive_directory_iterator level()
+ ASSERT_NO_ERROR(
+ fs::create_directories(Twine(TestDirectory) + "/reclevel/a/b/c"));
+ fs::recursive_directory_iterator I(Twine(TestDirectory) + "/reclevel", ec), E;
+ for (int l = 0; I != E; I.increment(ec), ++l) {
+ ASSERT_NO_ERROR(ec);
+ EXPECT_EQ(I.level(), l);
+ }
+ EXPECT_EQ(I, E);
+ ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/reclevel/a/b/c"));
+ ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/reclevel/a/b"));
+ ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/reclevel/a"));
+ ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "/reclevel"));
}
const char archive[] = "!<arch>\x0A";
More information about the llvm-commits
mailing list