aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/ErrorTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-08-29 23:29:09 +0000
committerLang Hames <lhames@gmail.com>2017-08-29 23:29:09 +0000
commit3025e48a88d56cd156cbc81b2ac18adff513182c (patch)
treee3c0af46df39d2f11bff39cbb5d724c311af1f71 /llvm/unittests/Support/ErrorTest.cpp
parent559f61e17934ca7c809173d52e1dbd38851c6506 (diff)
downloadllvm-3025e48a88d56cd156cbc81b2ac18adff513182c.zip
llvm-3025e48a88d56cd156cbc81b2ac18adff513182c.tar.gz
llvm-3025e48a88d56cd156cbc81b2ac18adff513182c.tar.bz2
[Error] Add an optional error message to cantFail.
cantFail is the moral equivalent of an assertion that the wrapped call must return a success value. This patch allows clients to include an associated error message (the same way they would for an assertion for llvm_unreachable). If the error message is not specified it will default to: "Failure value returned from cantFail wrapped call". llvm-svn: 312066
Diffstat (limited to 'llvm/unittests/Support/ErrorTest.cpp')
-rw-r--r--llvm/unittests/Support/ErrorTest.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/unittests/Support/ErrorTest.cpp b/llvm/unittests/Support/ErrorTest.cpp
index db332eb..6010122 100644
--- a/llvm/unittests/Support/ErrorTest.cpp
+++ b/llvm/unittests/Support/ErrorTest.cpp
@@ -486,8 +486,9 @@ TEST(Error, CantFailSuccess) {
#if LLVM_ENABLE_ABI_BREAKING_CHECKS && !defined(NDEBUG)
TEST(Error, CantFailDeath) {
EXPECT_DEATH(
- cantFail(make_error<StringError>("foo", inconvertibleErrorCode())),
- "Failure value returned from cantFail wrapped call")
+ cantFail(make_error<StringError>("foo", inconvertibleErrorCode()),
+ "Cantfail call failed"),
+ "Cantfail call failed")
<< "cantFail(Error) did not cause an abort for failure value";
EXPECT_DEATH(