forked from OSchip/llvm-project
[DirectoryWatcher][NFC][test] Add typedef for enum
llvm-svn: 366137
This commit is contained in:
parent
8528b1951c
commit
5076038bb0
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue