]> granicus.if.org Git - clang/commitdiff
[DirectoryWatcher][NFC][test] Add typedef for enum
authorJan Korous <jkorous@apple.com>
Mon, 15 Jul 2019 22:11:28 +0000 (22:11 +0000)
committerJan Korous <jkorous@apple.com>
Mon, 15 Jul 2019 22:11:28 +0000 (22:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366137 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/DirectoryWatcher/DirectoryWatcherTest.cpp

index 72bc86d4493cf4cbbaf53da6bdcdabc23ae1ff55..9b0e1077abce06442016561c8820f44f6a14a0a5 100644 (file)
@@ -32,6 +32,8 @@ static bool operator==(const DirectoryWatcher::Event &lhs,
 
 namespace {
 
+typedef DirectoryWatcher::Event::EventKind EventKind;
+
 struct DirectoryWatcherTestFixture {
   std::string TestRootDir;
   std::string TestWatchedDir;
@@ -81,15 +83,15 @@ struct DirectoryWatcherTestFixture {
   }
 };
 
-std::string eventKindToString(const DirectoryWatcher::Event::EventKind K) {
+std::string eventKindToString(const EventKind K) {
   switch (K) {
-  case DirectoryWatcher::Event::EventKind::Removed:
+  case EventKind::Removed:
     return "Removed";
-  case DirectoryWatcher::Event::EventKind::Modified:
+  case EventKind::Modified:
     return "Modified";
-  case DirectoryWatcher::Event::EventKind::WatchedDirRemoved:
+  case EventKind::WatchedDirRemoved:
     return "WatchedDirRemoved";
-  case DirectoryWatcher::Event::EventKind::WatcherGotInvalidated:
+  case EventKind::WatcherGotInvalidated:
     return "WatcherGotInvalidated";
   }
   llvm_unreachable("unknown event kind");
@@ -249,7 +251,6 @@ void checkEventualResultWithTimeout(VerifyingConsumer &TestConsumer) {
       !TestConsumer.result().hasValue())
     TestConsumer.printUnmetExpectations(llvm::outs());
 }
-
 } // namespace
 
 TEST(DirectoryWatcherTest, InitialScanSync) {
@@ -260,9 +261,9 @@ TEST(DirectoryWatcherTest, InitialScanSync) {
   fixture.addFile("c");
 
   VerifyingConsumer TestConsumer{
-      {{DirectoryWatcher::Event::EventKind::Modified, "a"},
-       {DirectoryWatcher::Event::EventKind::Modified, "b"},
-       {DirectoryWatcher::Event::EventKind::Modified, "c"}},
+      {{EventKind::Modified, "a"},
+       {EventKind::Modified, "b"},
+       {EventKind::Modified, "c"}},
       {}};
 
   auto DW = DirectoryWatcher::create(
@@ -284,9 +285,9 @@ TEST(DirectoryWatcherTest, InitialScanAsync) {
   fixture.addFile("c");
 
   VerifyingConsumer TestConsumer{
-      {{DirectoryWatcher::Event::EventKind::Modified, "a"},
-       {DirectoryWatcher::Event::EventKind::Modified, "b"},
-       {DirectoryWatcher::Event::EventKind::Modified, "c"}},
+      {{EventKind::Modified, "a"},
+       {EventKind::Modified, "b"},
+       {EventKind::Modified, "c"}},
       {}};
 
   auto DW = DirectoryWatcher::create(
@@ -305,9 +306,9 @@ TEST(DirectoryWatcherTest, AddFiles) {
 
   VerifyingConsumer TestConsumer{
       {},
-      {{DirectoryWatcher::Event::EventKind::Modified, "a"},
-       {DirectoryWatcher::Event::EventKind::Modified, "b"},
-       {DirectoryWatcher::Event::EventKind::Modified, "c"}}};
+      {{EventKind::Modified, "a"},
+       {EventKind::Modified, "b"},
+       {EventKind::Modified, "c"}}};
 
   auto DW = DirectoryWatcher::create(
       fixture.TestWatchedDir,
@@ -330,8 +331,8 @@ TEST(DirectoryWatcherTest, ModifyFile) {
   fixture.addFile("a");
 
   VerifyingConsumer TestConsumer{
-      {{DirectoryWatcher::Event::EventKind::Modified, "a"}},
-      {{DirectoryWatcher::Event::EventKind::Modified, "a"}}};
+      {{EventKind::Modified, "a"}},
+      {{EventKind::Modified, "a"}}};
 
   auto DW = DirectoryWatcher::create(
       fixture.TestWatchedDir,
@@ -359,8 +360,8 @@ TEST(DirectoryWatcherTest, DeleteFile) {
   fixture.addFile("a");
 
   VerifyingConsumer TestConsumer{
-      {{DirectoryWatcher::Event::EventKind::Modified, "a"}},
-      {{DirectoryWatcher::Event::EventKind::Removed, "a"}}};
+      {{EventKind::Modified, "a"}},
+      {{EventKind::Removed, "a"}}};
 
   auto DW = DirectoryWatcher::create(
       fixture.TestWatchedDir,
@@ -380,8 +381,8 @@ TEST(DirectoryWatcherTest, DeleteWatchedDir) {
 
   VerifyingConsumer TestConsumer{
       {},
-      {{DirectoryWatcher::Event::EventKind::WatchedDirRemoved, ""},
-       {DirectoryWatcher::Event::EventKind::WatcherGotInvalidated, ""}}};
+      {{EventKind::WatchedDirRemoved, ""},
+       {EventKind::WatcherGotInvalidated, ""}}};
 
   auto DW = DirectoryWatcher::create(
       fixture.TestWatchedDir,
@@ -400,7 +401,7 @@ TEST(DirectoryWatcherTest, InvalidatedWatcher) {
   DirectoryWatcherTestFixture fixture;
 
   VerifyingConsumer TestConsumer{
-      {}, {{DirectoryWatcher::Event::EventKind::WatcherGotInvalidated, ""}}};
+      {}, {{EventKind::WatcherGotInvalidated, ""}}};
 
   {
     auto DW = DirectoryWatcher::create(