#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
#include <condition_variable>
#include <future>
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/true);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
checkEventualResultWithTimeout(TestConsumer);
}
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/false);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
checkEventualResultWithTimeout(TestConsumer);
}
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/true);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
fixture.addFile("a");
fixture.addFile("b");
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/true);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
// modify the file
{
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/true);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
fixture.deleteFile("a");
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/true);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
remove_directories(fixture.TestWatchedDir);
TestConsumer.consume(Events, IsInitial);
},
/*waitForInitialSync=*/true);
- if (!DW) {
- logAllUnhandledErrors(
- DW.takeError(), llvm::errs(),
- "DirectoryWatcherTest Failure on DirectoryWatcher::create(): ");
- exit(EXIT_FAILURE);
- }
+ ASSERT_THAT_ERROR(DW.takeError(), Succeeded());
} // DW is destructed here.
checkEventualResultWithTimeout(TestConsumer);