| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.services.refactoring; | 5 library test.services.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:analysis_server/src/services/correction/status.dart'; | 10 import 'package:analysis_server/src/services/correction/status.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 Future assertRefactoringConditionsOK() { | 50 Future assertRefactoringConditionsOK() { |
| 51 return refactoring.checkInitialConditions().then((status) { | 51 return refactoring.checkInitialConditions().then((status) { |
| 52 assertRefactoringStatusOK(status); | 52 assertRefactoringStatusOK(status); |
| 53 return refactoring.checkFinalConditions().then((status) { | 53 return refactoring.checkFinalConditions().then((status) { |
| 54 assertRefactoringStatusOK(status); | 54 assertRefactoringStatusOK(status); |
| 55 }); | 55 }); |
| 56 }); | 56 }); |
| 57 } | 57 } |
| 58 | 58 |
| 59 /** | 59 /** |
| 60 * Asserts that [refactoring] final conditions status is OK. |
| 61 */ |
| 62 Future assertRefactoringFinalConditionsOK() { |
| 63 return refactoring.checkFinalConditions().then((status) { |
| 64 assertRefactoringStatusOK(status); |
| 65 }); |
| 66 } |
| 67 |
| 68 /** |
| 60 * Asserts that [status] has expected severity and message. | 69 * Asserts that [status] has expected severity and message. |
| 61 */ | 70 */ |
| 62 void assertRefactoringStatus(RefactoringStatus status, | 71 void assertRefactoringStatus(RefactoringStatus status, |
| 63 RefactoringProblemSeverity expectedSeverity, {String expectedMessage, | 72 RefactoringProblemSeverity expectedSeverity, {String expectedMessage, |
| 64 SourceRange expectedContextRange, String expectedContextSearch}) { | 73 SourceRange expectedContextRange, String expectedContextSearch}) { |
| 65 expect(status.severity, expectedSeverity, reason: status.toString()); | 74 expect(status.severity, expectedSeverity, reason: status.toString()); |
| 66 if (expectedSeverity != null) { | 75 if (expectedSeverity != null) { |
| 67 RefactoringProblem problem = status.problem; | 76 RefactoringProblem problem = status.problem; |
| 68 expect(problem.severity, expectedSeverity); | 77 expect(problem.severity, expectedSeverity); |
| 69 if (expectedMessage != null) { | 78 if (expectedMessage != null) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 CompilationUnit unit = resolveLibraryUnit(source); | 121 CompilationUnit unit = resolveLibraryUnit(source); |
| 113 index.indexUnit(context, unit); | 122 index.indexUnit(context, unit); |
| 114 } | 123 } |
| 115 | 124 |
| 116 void setUp() { | 125 void setUp() { |
| 117 super.setUp(); | 126 super.setUp(); |
| 118 index = createLocalMemoryIndex(); | 127 index = createLocalMemoryIndex(); |
| 119 searchEngine = new SearchEngineImpl(index); | 128 searchEngine = new SearchEngineImpl(index); |
| 120 } | 129 } |
| 121 } | 130 } |
| OLD | NEW |