summaryrefslogtreecommitdiffstats
path: root/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
diff options
context:
space:
mode:
authorJan Korous <jkorous@apple.com>2019-07-15 22:11:28 +0000
committerJan Korous <jkorous@apple.com>2019-07-15 22:11:28 +0000
commit5076038bb00dd5643cb4c0a881629126b359c828 (patch)
tree6884a9dd35fe260d579431fc84ddd9a09f6fe64e /clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
parent8528b1951cc6fda2c7bb09b259cf81f222550f82 (diff)
downloadbcm5719-llvm-5076038bb00dd5643cb4c0a881629126b359c828.tar.gz
bcm5719-llvm-5076038bb00dd5643cb4c0a881629126b359c828.zip
[DirectoryWatcher][NFC][test] Add typedef for enum
llvm-svn: 366137
Diffstat (limited to 'clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp')
-rw-r--r--clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
index 72bc86d4493..9b0e1077abc 100644
--- a/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
+++ b/clang/unittests/DirectoryWatcher/DirectoryWatcherTest.cpp
@@ -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(
OpenPOWER on IntegriCloud