Skip to content

Commit 11b0624

Browse files
committed
[clangd] Fix error message in tweaktests to be useful. NFC
llvm-svn: 366311
1 parent 247add6 commit 11b0624

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang-tools-extra/clangd/unittests/TweakTests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ADT/StringRef.h"
1818
#include "llvm/Support/Error.h"
1919
#include "llvm/Testing/Support/Error.h"
20+
#include "gmock/gmock-matchers.h"
2021
#include "gmock/gmock.h"
2122
#include "gtest/gtest.h"
2223
#include <cassert>
@@ -134,10 +135,9 @@ void checkApplyContainsError(llvm::StringRef ID, llvm::StringRef Input,
134135
auto Result = apply(ID, Input);
135136
ASSERT_FALSE(Result) << "expected error message:\n " << ErrorMessage <<
136137
"\non input:" << Input;
137-
EXPECT_NE(std::string::npos,
138-
llvm::toString(Result.takeError()).find(ErrorMessage))
139-
<< "Wrong error message:\n " << llvm::toString(Result.takeError())
140-
<< "\nexpected:\n " << ErrorMessage;
138+
EXPECT_THAT(llvm::toString(Result.takeError()),
139+
testing::HasSubstr(ErrorMessage))
140+
<< Input;
141141
}
142142

143143
TEST(TweakTest, SwapIfBranches) {

0 commit comments

Comments
 (0)