[clang-tools-extra] r366311 - [clangd] Fix error message in tweaktests to be useful. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 17 03:17:47 PDT 2019
Author: sammccall
Date: Wed Jul 17 03:17:47 2019
New Revision: 366311
URL: http://llvm.org/viewvc/llvm-project?rev=366311&view=rev
Log:
[clangd] Fix error message in tweaktests to be useful. NFC
Modified:
clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
Modified: clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp?rev=366311&r1=366310&r2=366311&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp (original)
+++ clang-tools-extra/trunk/clangd/unittests/TweakTests.cpp Wed Jul 17 03:17:47 2019
@@ -17,6 +17,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Testing/Support/Error.h"
+#include "gmock/gmock-matchers.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <cassert>
@@ -134,10 +135,9 @@ void checkApplyContainsError(llvm::Strin
auto Result = apply(ID, Input);
ASSERT_FALSE(Result) << "expected error message:\n " << ErrorMessage <<
"\non input:" << Input;
- EXPECT_NE(std::string::npos,
- llvm::toString(Result.takeError()).find(ErrorMessage))
- << "Wrong error message:\n " << llvm::toString(Result.takeError())
- << "\nexpected:\n " << ErrorMessage;
+ EXPECT_THAT(llvm::toString(Result.takeError()),
+ testing::HasSubstr(ErrorMessage))
+ << Input;
}
TEST(TweakTest, SwapIfBranches) {
More information about the cfe-commits
mailing list