diff options
author | Pavel Labath <labath@google.com> | 2018-04-10 14:11:53 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2018-04-10 14:11:53 +0000 |
commit | 397e150ddcf2556fa36ce5c675db9315976ed4ca (patch) | |
tree | a62d284cdb66e61eb3ad66656dcb85c4db07afc5 /llvm/unittests/Support/ErrorTest.cpp | |
parent | a3e7510a4c64bc28053aed99524674610bb292e5 (diff) | |
download | llvm-397e150ddcf2556fa36ce5c675db9315976ed4ca.zip llvm-397e150ddcf2556fa36ce5c675db9315976ed4ca.tar.gz llvm-397e150ddcf2556fa36ce5c675db9315976ed4ca.tar.bz2 |
[Testing/Support] Make Failed() matcher work with abstract error types
Failed<ErrorInfoBase>() did not compile, because it was attempting to
create a copy of the Error object when passing it to the nested matcher,
which was not possible because ErrorInfoBase is abstract.
This commit fixes the problem by making sure we pass the ErrorInfo
object by reference, which also improves the handling of non-abstract
objects, as we avoid potentially slicing an object during the copy.
llvm-svn: 329703
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
-rw-r--r-- | llvm/unittests/Support/ErrorTest.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp index d03db26..529439f 100644 --- a/llvm/unittests/Support/ErrorTest.cpp +++ b/llvm/unittests/Support/ErrorTest.cpp @@ -749,6 +749,7 @@ TEST(Error, ErrorMatchers) { "Expected: failed with Error of given type and the error is an object " "whose given property is equal to 1\n" " Actual: failed (CustomError { 0})"); + EXPECT_THAT_ERROR(make_error<CustomError>(0), Failed<ErrorInfoBase>()); EXPECT_THAT_EXPECTED(Expected<int>(0), Succeeded()); EXPECT_NONFATAL_FAILURE( |