namespace {
+typedef DirectoryWatcher::Event::EventKind EventKind;
+
struct DirectoryWatcherTestFixture {
std::string TestRootDir;
std::string TestWatchedDir;
}
};
-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");
!TestConsumer.result().hasValue())
TestConsumer.printUnmetExpectations(llvm::outs());
}
-
} // namespace
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(
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(
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,
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,
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,
VerifyingConsumer TestConsumer{
{},
- {{DirectoryWatcher::Event::EventKind::WatchedDirRemoved, ""},
- {DirectoryWatcher::Event::EventKind::WatcherGotInvalidated, ""}}};
+ {{EventKind::WatchedDirRemoved, ""},
+ {EventKind::WatcherGotInvalidated, ""}}};
auto DW = DirectoryWatcher::create(
fixture.TestWatchedDir,
DirectoryWatcherTestFixture fixture;
VerifyingConsumer TestConsumer{
- {}, {{DirectoryWatcher::Event::EventKind::WatcherGotInvalidated, ""}}};
+ {}, {{EventKind::WatcherGotInvalidated, ""}}};
{
auto DW = DirectoryWatcher::create(