| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 Future assertRefactoringFinalConditionsOK() async { | 85 Future assertRefactoringFinalConditionsOK() async { |
| 86 RefactoringStatus status = await refactoring.checkFinalConditions(); | 86 RefactoringStatus status = await refactoring.checkFinalConditions(); |
| 87 assertRefactoringStatusOK(status); | 87 assertRefactoringStatusOK(status); |
| 88 } | 88 } |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * Asserts that [status] has expected severity and message. | 91 * Asserts that [status] has expected severity and message. |
| 92 */ | 92 */ |
| 93 void assertRefactoringStatus( | 93 void assertRefactoringStatus( |
| 94 RefactoringStatus status, RefactoringProblemSeverity expectedSeverity, | 94 RefactoringStatus status, RefactoringProblemSeverity expectedSeverity, |
| 95 {String expectedMessage, SourceRange expectedContextRange, | 95 {String expectedMessage, |
| 96 SourceRange expectedContextRange, |
| 96 String expectedContextSearch}) { | 97 String expectedContextSearch}) { |
| 97 expect(status.severity, expectedSeverity, reason: status.toString()); | 98 expect(status.severity, expectedSeverity, reason: status.toString()); |
| 98 if (expectedSeverity != null) { | 99 if (expectedSeverity != null) { |
| 99 RefactoringProblem problem = status.problem; | 100 RefactoringProblem problem = status.problem; |
| 100 expect(problem.severity, expectedSeverity); | 101 expect(problem.severity, expectedSeverity); |
| 101 if (expectedMessage != null) { | 102 if (expectedMessage != null) { |
| 102 expect(problem.message, expectedMessage); | 103 expect(problem.message, expectedMessage); |
| 103 } | 104 } |
| 104 if (expectedContextRange != null) { | 105 if (expectedContextRange != null) { |
| 105 expect(problem.location.offset, expectedContextRange.offset); | 106 expect(problem.location.offset, expectedContextRange.offset); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 CompilationUnit unit = resolveLibraryUnit(source); | 156 CompilationUnit unit = resolveLibraryUnit(source); |
| 156 index.indexUnit(context, unit); | 157 index.indexUnit(context, unit); |
| 157 } | 158 } |
| 158 | 159 |
| 159 void setUp() { | 160 void setUp() { |
| 160 super.setUp(); | 161 super.setUp(); |
| 161 index = createLocalMemoryIndex(); | 162 index = createLocalMemoryIndex(); |
| 162 searchEngine = new SearchEngineImpl(index); | 163 searchEngine = new SearchEngineImpl(index); |
| 163 } | 164 } |
| 164 } | 165 } |
| OLD | NEW |