]> granicus.if.org Git - llvm/commit
ProfData: Fix some unchecked Errors in unit tests
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 7 Jul 2017 21:02:59 +0000 (21:02 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 7 Jul 2017 21:02:59 +0000 (21:02 +0000)
commit8c2dc92bd4a2c8772b4d00567513eab39db47984
treeef1eef70a93c41b458235a3ac0b08bcf0eb04a78
parentb1f864a94769b7d0fd8f724cc6dbfe5195683d63
ProfData: Fix some unchecked Errors in unit tests

The 'NoError' function was meant to be used as the input to
ASSERT/EXPECT_TRUE, but it is easy to forget this (it could be annotated
with nodiscard to help this) so many sites that look like they're checked
are not (& silently discard the failure). Only one site actually has an
Error sneaking out this way and I've replaced that one with a
FIXME+consumeError.

The rest of the code has been modified to use the EXPECT_THAT_ERROR
macros Zach introduced a while back. Between the options available this
seems OK/good/something to standardize on - though it's difficult to
build a matcher that could handle checking for a specific llvm::Error
result, so those remain using the custom ErrorEquals (& the nodiscard
added to ensure it is not misused as it was previous to this patch). It
could still be generalized a bit further (even not as far as a matcher,
but at least support multiple kinds of Error, etc) & added to the
general Error utility header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307440 91177308-0d34-0410-b5e6-96231b3b80d8
unittests/ProfileData/CMakeLists.txt
unittests/ProfileData/CoverageMappingTest.cpp
unittests/ProfileData/InstrProfTest.cpp