summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-10-16 18:28:26 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-10-16 18:28:26 +0000
commitf5ca27cc3785b3a2bf9dd3c005f3aa6a2d14fb93 (patch)
treee0d6662c56210c40468176f4a6cf6464da760592 /clang/unittests
parent528435002ace8d5b1752cc97ece76687689f9bc6 (diff)
downloadbcm5719-llvm-f5ca27cc3785b3a2bf9dd3c005f3aa6a2d14fb93.tar.gz
bcm5719-llvm-f5ca27cc3785b3a2bf9dd3c005f3aa6a2d14fb93.zip
[refactor] allow the use of refactoring diagnostics
This commit allows the refactoring library to use its own set of refactoring-specific diagnostics to reports things like initiation errors. Differential Revision: https://reviews.llvm.org/D38772 llvm-svn: 315924
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/Tooling/RefactoringActionRulesTest.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/unittests/Tooling/RefactoringActionRulesTest.cpp b/clang/unittests/Tooling/RefactoringActionRulesTest.cpp
index ffd54cc33e6..132a3a44963 100644
--- a/clang/unittests/Tooling/RefactoringActionRulesTest.cpp
+++ b/clang/unittests/Tooling/RefactoringActionRulesTest.cpp
@@ -11,6 +11,7 @@
#include "RewriterTestContext.h"
#include "clang/Tooling/Refactoring.h"
#include "clang/Tooling/Refactoring/RefactoringActionRules.h"
+#include "clang/Tooling/Refactoring/RefactoringDiagnostic.h"
#include "clang/Tooling/Refactoring/Rename/SymbolName.h"
#include "clang/Tooling/Tooling.h"
#include "llvm/Support/Errc.h"
@@ -128,12 +129,12 @@ TEST_F(RefactoringActionRulesTest, MyFirstRefactoringRule) {
createReplacements(Rule, RefContext);
ASSERT_TRUE(!ErrorOrResult);
- std::string Message;
- llvm::handleAllErrors(
- ErrorOrResult.takeError(),
- [&](llvm::StringError &Error) { Message = Error.getMessage(); });
- EXPECT_EQ(Message,
- "refactoring action can't be initiated without a selection");
+ unsigned DiagID;
+ llvm::handleAllErrors(ErrorOrResult.takeError(),
+ [&](DiagnosticError &Error) {
+ DiagID = Error.getDiagnostic().second.getDiagID();
+ });
+ EXPECT_EQ(DiagID, diag::err_refactor_no_selection);
}
}
OpenPOWER on IntegriCloud