| Index: pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| index 956de7e5ff126dbf5506bbced1bb014e72e5e14a..a092f1e78a71491d9d4b8a217d4fe756e7b7c76d 100644
|
| --- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| +++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
|
| @@ -15,13 +15,11 @@ import 'package:unittest/unittest.dart';
|
| import '../../reflective_tests.dart';
|
| import 'abstract_refactoring.dart';
|
|
|
| -
|
| main() {
|
| groupSep = ' | ';
|
| runReflectiveTests(ExtractMethodTest);
|
| }
|
|
|
| -
|
| @reflectiveTest
|
| class ExtractMethodTest extends RefactoringTest {
|
| ExtractMethodRefactoringImpl refactoring;
|
| @@ -421,7 +419,7 @@ main() {
|
| _createRefactoringForStartEndString('print(0', 'rint(1)');
|
| return _assertConditionsFatal(
|
| "The selection does not cover a set of statements or an expression. "
|
| - "Extend selection to a valid range.");
|
| + "Extend selection to a valid range.");
|
| }
|
|
|
| test_bad_statements_exit_notAllExecutionFlows() {
|
| @@ -452,7 +450,7 @@ main() {
|
| _createRefactoringForStartEndComments();
|
| return _assertConditionsFatal(
|
| "Ambiguous return value: Selected block contains assignment(s) to "
|
| - "local variables and return statement.");
|
| + "local variables and return statement.");
|
| }
|
|
|
| test_bad_switchCase() {
|
| @@ -468,7 +466,7 @@ main() {
|
| _createRefactoringForStartEndComments();
|
| return _assertConditionsFatal(
|
| "Selection must either cover whole switch statement "
|
| - "or parts of a single case block.");
|
| + "or parts of a single case block.");
|
| }
|
|
|
| test_bad_tokensBetweenLastNodeAndSelectionEnd() {
|
| @@ -513,7 +511,7 @@ main() {
|
| _createRefactoringForStartEndComments();
|
| return _assertConditionsFatal(
|
| "Selection must either cover whole try statement or "
|
| - "parts of try, catch, or finally block.");
|
| + "parts of try, catch, or finally block.");
|
| }
|
|
|
| test_bad_try_catchBlock_complete() {
|
| @@ -530,7 +528,7 @@ main() {
|
| _createRefactoringForStartEndComments();
|
| return _assertConditionsFatal(
|
| "Selection must either cover whole try statement or "
|
| - "parts of try, catch, or finally block.");
|
| + "parts of try, catch, or finally block.");
|
| }
|
|
|
| test_bad_try_catchBlock_exception() {
|
| @@ -564,7 +562,7 @@ main() {
|
| _createRefactoringForStartEndComments();
|
| return _assertConditionsFatal(
|
| "Selection must either cover whole try statement or "
|
| - "parts of try, catch, or finally block.");
|
| + "parts of try, catch, or finally block.");
|
| }
|
|
|
| test_bad_try_tryBlock() {
|
| @@ -581,7 +579,7 @@ main() {
|
| _createRefactoringForStartEndComments();
|
| return _assertConditionsFatal(
|
| "Selection must either cover whole try statement or "
|
| - "parts of try, catch, or finally block.");
|
| + "parts of try, catch, or finally block.");
|
| }
|
|
|
| test_bad_typeReference() {
|
| @@ -711,14 +709,12 @@ main() {
|
| // null
|
| refactoring.name = null;
|
| assertRefactoringStatus(
|
| - refactoring.checkName(),
|
| - RefactoringProblemSeverity.FATAL,
|
| + refactoring.checkName(), RefactoringProblemSeverity.FATAL,
|
| expectedMessage: "Method name must not be null.");
|
| // empty
|
| refactoring.name = '';
|
| assertRefactoringStatus(
|
| - refactoring.checkName(),
|
| - RefactoringProblemSeverity.FATAL,
|
| + refactoring.checkName(), RefactoringProblemSeverity.FATAL,
|
| expectedMessage: "Method name must not be empty.");
|
| // OK
|
| refactoring.name = 'res';
|
| @@ -811,11 +807,8 @@ main() {
|
| _createRefactoringForString('(x) => x * k');
|
| // check
|
| RefactoringStatus status = await refactoring.checkInitialConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| - expectedMessage:
|
| - 'Cannot extract closure as method, it references 1 external variable(s).');
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| + expectedMessage: 'Cannot extract closure as method, it references 1 external variable(s).');
|
| }
|
|
|
| test_closure_bad_referencesParameter() async {
|
| @@ -828,11 +821,8 @@ main(int k) {
|
| _createRefactoringForString('(x) => x * k');
|
| // check
|
| RefactoringStatus status = await refactoring.checkInitialConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| - expectedMessage:
|
| - 'Cannot extract closure as method, it references 1 external variable(s).');
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| + expectedMessage: 'Cannot extract closure as method, it references 1 external variable(s).');
|
| }
|
|
|
| test_fromTopLevelVariableInitializerClosure() {
|
| @@ -1022,8 +1012,7 @@ main() {
|
| _createRefactoringWithSuffix('getSelectedItem()', '); // marker');
|
| // check names
|
| await refactoring.checkInitialConditions();
|
| - expect(
|
| - refactoring.names,
|
| + expect(refactoring.names,
|
| unorderedEquals(['selectedItem', 'item', 'my', 'treeItem2']));
|
| }
|
|
|
| @@ -1037,8 +1026,7 @@ main() {
|
| _createRefactoringForString('1 + 2');
|
| // apply refactoring
|
| await refactoring.checkInitialConditions();
|
| - expect(
|
| - refactoring.offsets,
|
| + expect(refactoring.offsets,
|
| unorderedEquals([findOffset('1 + 2'), findOffset('1 + 2')]));
|
| expect(refactoring.lengths, unorderedEquals([5, 6]));
|
| }
|
| @@ -2466,25 +2454,19 @@ Future<int> newFuture() => null;
|
|
|
| Future _assertConditionsError(String message) async {
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.ERROR,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
|
| expectedMessage: message);
|
| }
|
|
|
| Future _assertConditionsFatal(String message) async {
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: message);
|
| }
|
|
|
| Future _assertFinalConditionsError(String message) async {
|
| RefactoringStatus status = await refactoring.checkFinalConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.ERROR,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.ERROR,
|
| expectedMessage: message);
|
| }
|
|
|
| @@ -2516,8 +2498,8 @@ Future<int> newFuture() => null;
|
| _createRefactoring(offset, end - offset);
|
| }
|
|
|
| - void _createRefactoringForStartEndString(String startSearch,
|
| - String endSearch) {
|
| + void _createRefactoringForStartEndString(
|
| + String startSearch, String endSearch) {
|
| int offset = findOffset(startSearch);
|
| int end = findOffset(endSearch);
|
| _createRefactoring(offset, end - offset);
|
|
|