diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-10-16 18:28:26 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-10-16 18:28:26 +0000 |
commit | 6de2efd1953adaa9a190b2cdfbe7b5c15f6d6efe (patch) | |
tree | 1728368a264c212d5c7d90e5d03e247bb5a0afc7 /unittests | |
parent | e9ec96ff9701eec60e4bafd9b3e5b2daa6b101cc (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315924 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Tooling/RefactoringActionRulesTest.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/unittests/Tooling/RefactoringActionRulesTest.cpp b/unittests/Tooling/RefactoringActionRulesTest.cpp index ffd54cc33e..132a3a4496 100644 --- a/unittests/Tooling/RefactoringActionRulesTest.cpp +++ b/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); } } |