| Index: pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| index 75ad10bc19f896e62001cf9a43a1292803d11eca..32b2a57dfda28a88bdc278a2b27b336e9460e62f 100644
|
| --- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| +++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
|
| @@ -15,13 +15,11 @@ import 'package:unittest/unittest.dart';
|
| import '../../reflective_tests.dart';
|
| import 'abstract_refactoring.dart';
|
|
|
| -
|
| main() {
|
| groupSep = ' | ';
|
| runReflectiveTests(ExtractLocalTest);
|
| }
|
|
|
| -
|
| @reflectiveTest
|
| class ExtractLocalTest extends RefactoringTest {
|
| ExtractLocalRefactoringImpl refactoring;
|
| @@ -36,11 +34,8 @@ main() {
|
| _createRefactoringForString('1 + 2');
|
| // conflicting name
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.WARNING,
|
| - expectedMessage:
|
| - "A variable with name 'res' is already defined in the visible scope.");
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.WARNING,
|
| + expectedMessage: "A variable with name 'res' is already defined in the visible scope.");
|
| }
|
|
|
| test_checkFinalConditions_sameVariable_before() async {
|
| @@ -53,11 +48,8 @@ main() {
|
| _createRefactoringForString('1 + 2');
|
| // conflicting name
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.WARNING,
|
| - expectedMessage:
|
| - "A variable with name 'res' is already defined in the visible scope.");
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.WARNING,
|
| + expectedMessage: "A variable with name 'res' is already defined in the visible scope.");
|
| }
|
|
|
| test_checkInitialConditions_assignmentLeftHandSize() async {
|
| @@ -70,9 +62,7 @@ main() {
|
| _createRefactoringWithSuffix('v', ' = 1;');
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: 'Cannot extract the left-hand side of an assignment.');
|
| }
|
|
|
| @@ -85,9 +75,7 @@ main() {
|
| _createRefactoringWithSuffix('main', '();');
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: 'Cannot extract a single method name.');
|
| }
|
|
|
| @@ -100,9 +88,7 @@ main(p) {
|
| _createRefactoringWithSuffix('value', '; // marker');
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: 'Cannot extract name part of a property access.');
|
| }
|
|
|
| @@ -116,9 +102,7 @@ String foo() => '';
|
| _createRefactoringWithSuffix('length', '; // marker');
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: 'Cannot extract name part of a property access.');
|
| }
|
|
|
| @@ -131,9 +115,7 @@ main() {
|
| _createRefactoringWithSuffix('vvv', ' = 0;');
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: 'Cannot extract the name part of a declaration.');
|
| }
|
|
|
| @@ -144,11 +126,8 @@ int a = 1 + 2;
|
| _createRefactoringForString('1 + 2');
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| - expectedMessage:
|
| - 'Expression inside of function must be selected to activate this refactoring.');
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| + expectedMessage: 'Expression inside of function must be selected to activate this refactoring.');
|
| }
|
|
|
| test_checkInitialConditions_stringSelection_leadingQuote() async {
|
| @@ -160,11 +139,8 @@ main() {
|
| _createRefactoringForString("'a");
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| - expectedMessage:
|
| - 'Cannot extract only leading or trailing quote of string literal.');
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| + expectedMessage: 'Cannot extract only leading or trailing quote of string literal.');
|
| }
|
|
|
| test_checkInitialConditions_stringSelection_trailingQuote() async {
|
| @@ -176,11 +152,8 @@ main() {
|
| _createRefactoringForString("c'");
|
| // check conditions
|
| RefactoringStatus status = await refactoring.checkAllConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| - expectedMessage:
|
| - 'Cannot extract only leading or trailing quote of string literal.');
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| + expectedMessage: 'Cannot extract only leading or trailing quote of string literal.');
|
| }
|
|
|
| test_checkLocalName() {
|
| @@ -194,14 +167,12 @@ main() {
|
| // null
|
| refactoring.name = null;
|
| assertRefactoringStatus(
|
| - refactoring.checkName(),
|
| - RefactoringProblemSeverity.FATAL,
|
| + refactoring.checkName(), RefactoringProblemSeverity.FATAL,
|
| expectedMessage: "Variable name must not be null.");
|
| // empty
|
| refactoring.name = '';
|
| assertRefactoringStatus(
|
| - refactoring.checkName(),
|
| - RefactoringProblemSeverity.FATAL,
|
| + refactoring.checkName(), RefactoringProblemSeverity.FATAL,
|
| expectedMessage: "Variable name must not be empty.");
|
| // OK
|
| refactoring.name = 'res';
|
| @@ -484,8 +455,7 @@ main() {
|
| _createRefactoringWithSuffix('getSelectedItem()', '); // marker');
|
| // check guesses
|
| await refactoring.checkInitialConditions();
|
| - expect(
|
| - refactoring.names,
|
| + expect(refactoring.names,
|
| unorderedEquals(['selectedItem', 'item', 'my', 'treeItem']));
|
| }
|
|
|
| @@ -691,8 +661,7 @@ main() {
|
| _createRefactoringWithSuffix('foo()', '; // marker');
|
| // check offsets
|
| await refactoring.checkInitialConditions();
|
| - expect(
|
| - refactoring.offsets,
|
| + expect(refactoring.offsets,
|
| unorderedEquals([findOffset('foo();'), findOffset('foo( );')]));
|
| expect(refactoring.lengths, unorderedEquals([5, 6]));
|
| }
|
| @@ -944,9 +913,7 @@ main() {
|
|
|
| Future _assertInitialConditions_fatal_selection() async {
|
| RefactoringStatus status = await refactoring.checkInitialConditions();
|
| - assertRefactoringStatus(
|
| - status,
|
| - RefactoringProblemSeverity.FATAL,
|
| + assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
|
| expectedMessage: 'Expression must be selected to activate this refactoring.');
|
| }
|
|
|
|
|