mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 19:31:58 +00:00
UnitTests/Path: More ASSERT_NO_ERROR cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122947 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6cf34abe1c
commit
f9fd07864e
@ -10,6 +10,7 @@
|
||||
#include "llvm/Support/FileSystem.h"
|
||||
#include "llvm/Support/PathV2.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
@ -17,12 +18,13 @@ using namespace llvm;
|
||||
using namespace llvm::sys;
|
||||
|
||||
#define ASSERT_NO_ERROR(x) \
|
||||
if (error_code ec = x) { \
|
||||
SmallString<128> Message; \
|
||||
GTEST_FATAL_FAILURE_((Twine(#x ": did not return errc::success.\n") + \
|
||||
"error number: " + Twine(ec.value()) + "\n" + \
|
||||
"error message: " + \
|
||||
ec.message()).toNullTerminatedStringRef(Message).data()); \
|
||||
if (error_code ASSERT_NO_ERROR_ec = x) { \
|
||||
SmallString<128> MessageStorage; \
|
||||
raw_svector_ostream Message(MessageStorage); \
|
||||
Message << #x ": did not return errc::success.\n" \
|
||||
<< "error number: " << ASSERT_NO_ERROR_ec.value() << "\n" \
|
||||
<< "error message: " << ASSERT_NO_ERROR_ec.message() << "\n"; \
|
||||
GTEST_FATAL_FAILURE_(MessageStorage.c_str()); \
|
||||
} else {}
|
||||
|
||||
namespace {
|
||||
@ -206,12 +208,9 @@ TEST_F(FileSystemTest, TempFiles) {
|
||||
|
||||
TEST_F(FileSystemTest, DirectoryIteration) {
|
||||
error_code ec;
|
||||
for (fs::directory_iterator i(".", ec), e; i != e; i.increment(ec)) {
|
||||
if (ec) {
|
||||
errs() << ec.message() << '\n';
|
||||
errs().flush();
|
||||
report_fatal_error("Directory iteration failed!");
|
||||
}
|
||||
for (fs::directory_iterator i(".", ec), e; i != e; i.increment(ec))
|
||||
ASSERT_NO_ERROR(ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user