Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: pkg/analysis_server/test/edit/refactoring_test.dart

Issue 576473003: Split refactoring problems into init, options and final. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/edit/refactoring_test.dart
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index e28c22706b6f521aca72a71feb838c5f3d15c1e0..0b75218bbdcf7db3664e037d7d47803d4991551f 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -97,7 +97,7 @@ main() {
return sendStringRequest('1 + 2', 'Name', true);
}).then((result) {
assertResultProblemsWarning(
- result,
+ result.optionsProblems,
'Variable name should start with a lowercase letter.');
// ...but there is still a change
assertTestRefactoringResult(result, '''
@@ -561,7 +561,7 @@ main() {
return _sendInlineRequest('main() {}');
}).then((result) {
assertResultProblemsFatal(
- result,
+ result.initialProblems,
'Local variable declaration or reference must be selected to activate this refactoring.');
// ...there is no any change
expect(result.change, isNull);
@@ -612,7 +612,7 @@ class A {
return _sendInlineRequest('// nothing');
}).then((result) {
assertResultProblemsFatal(
- result,
+ result.initialProblems,
'Method declaration or reference must be selected to activate this refactoring.');
// ...there is no any change
expect(result.change, isNull);
@@ -837,7 +837,9 @@ main() {
return getRefactoringResult(() {
return sendRenameRequest('Test {}', '');
}).then((result) {
- assertResultProblemsFatal(result, 'Class name must not be empty.');
+ assertResultProblemsFatal(
+ result.optionsProblems,
+ 'Class name must not be empty.');
// ...there is no any change
expect(result.change, isNull);
});
@@ -872,7 +874,7 @@ main() {
return sendRenameRequest('Test {}', 'newName');
}).then((result) {
assertResultProblemsWarning(
- result,
+ result.optionsProblems,
'Class name should start with an uppercase letter.');
// ...but there is still a change
assertTestRefactoringResult(result, '''
@@ -962,7 +964,9 @@ main() {
return getRefactoringResult(() {
return sendRenameRequest('// nothing', null);
}).then((result) {
- assertResultProblemsFatal(result, 'Unable to create a refactoring');
+ assertResultProblemsFatal(
+ result.initialProblems,
+ 'Unable to create a refactoring');
// ...there is no any change
expect(result.change, isNull);
});
@@ -1000,7 +1004,9 @@ main() {
return getRefactoringResult(() {
return sendRenameRequest('test = 0', 'newName');
}).then((result) {
- assertResultProblemsError(result, "Duplicate local variable 'newName'.");
+ assertResultProblemsError(
+ result.finalProblems,
+ "Duplicate local variable 'newName'.");
});
}
}
@@ -1009,11 +1015,10 @@ main() {
@ReflectiveTestCase()
class _AbstractGetRefactoring_Test extends AbstractAnalysisTest {
/**
- * Asserts that [result] has a single ERROR problem.
+ * Asserts that [problems] has a single ERROR problem.
*/
- void assertResultProblemsError(EditGetRefactoringResult result,
+ void assertResultProblemsError(List<RefactoringProblem> problems,
[String message]) {
- List<RefactoringProblem> problems = result.problems;
RefactoringProblem problem = problems[0];
expect(problems, hasLength(1));
expect(
@@ -1028,9 +1033,8 @@ class _AbstractGetRefactoring_Test extends AbstractAnalysisTest {
/**
* Asserts that [result] has a single FATAL problem.
*/
- void assertResultProblemsFatal(EditGetRefactoringResult result,
+ void assertResultProblemsFatal(List<RefactoringProblem> problems,
[String message]) {
- List<RefactoringProblem> problems = result.problems;
RefactoringProblem problem = problems[0];
expect(problems, hasLength(1));
expect(
@@ -1046,15 +1050,16 @@ class _AbstractGetRefactoring_Test extends AbstractAnalysisTest {
* Asserts that [result] has no problems at all.
*/
void assertResultProblemsOK(EditGetRefactoringResult result) {
- expect(result.problems, isEmpty);
+ expect(result.initialProblems, isEmpty);
+ expect(result.optionsProblems, isEmpty);
+ expect(result.finalProblems, isEmpty);
}
/**
* Asserts that [result] has a single WARNING problem.
*/
- void assertResultProblemsWarning(EditGetRefactoringResult result,
+ void assertResultProblemsWarning(List<RefactoringProblem> problems,
[String message]) {
- List<RefactoringProblem> problems = result.problems;
RefactoringProblem problem = problems[0];
expect(problems, hasLength(1));
expect(

Powered by Google App Engine
This is Rietveld 408576698