[clang] bb78dd2 - [RGT] StencilTest: Fix an assertion
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 18 14:13:50 PDT 2022
Author: Paul Robinson
Date: 2022-03-18T14:13:41-07:00
New Revision: bb78dd2e1f81323a631e2964d06a40aa10d5e2f5
URL: https://github.com/llvm/llvm-project/commit/bb78dd2e1f81323a631e2964d06a40aa10d5e2f5
DIFF: https://github.com/llvm/llvm-project/commit/bb78dd2e1f81323a631e2964d06a40aa10d5e2f5.diff
LOG: [RGT] StencilTest: Fix an assertion
ASSERT_THAT_EXPECTED implicitly calls takeError(), and calling
takeError() a second time returns nothing, so the check for the
content of the error text wasn't being executed.
Fixes Issue #48901
Found by the Rotten Green Tests project.
Added:
Modified:
clang/unittests/Tooling/StencilTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Tooling/StencilTest.cpp b/clang/unittests/Tooling/StencilTest.cpp
index 28cc8281485a8..1f49c1a30c041 100644
--- a/clang/unittests/Tooling/StencilTest.cpp
+++ b/clang/unittests/Tooling/StencilTest.cpp
@@ -627,7 +627,7 @@ TEST_F(StencilTest, CatOfInvalidRangeFails) {
ASSERT_TRUE(StmtMatch);
Stencil S = cat(node("arg"));
Expected<std::string> Result = S->eval(StmtMatch->Result);
- ASSERT_THAT_EXPECTED(Result, Failed<StringError>());
+ ASSERT_FALSE(Result);
llvm::handleAllErrors(Result.takeError(), [](const llvm::StringError &E) {
EXPECT_THAT(E.getMessage(), AllOf(HasSubstr("selected range"),
HasSubstr("macro expansion")));
More information about the cfe-commits
mailing list