| 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.extract_local; | 5 library test.services.refactoring.extract_local; |
| 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/refactoring/extract_local.dart'; | 10 import 'package:analysis_server/src/services/refactoring/extract_local.dart'; |
| 11 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
| 11 import 'package:analysis_testing/reflective_tests.dart'; | 12 import 'package:analysis_testing/reflective_tests.dart'; |
| 12 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
| 13 | 14 |
| 14 import 'abstract_refactoring.dart'; | 15 import 'abstract_refactoring.dart'; |
| 15 | 16 |
| 16 | 17 |
| 17 main() { | 18 main() { |
| 18 groupSep = ' | '; | 19 groupSep = ' | '; |
| 19 runReflectiveTests(ExtractLocalTest); | 20 runReflectiveTests(ExtractLocalTest); |
| 20 } | 21 } |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 Future _assertSuccessfulRefactoring(String expectedCode) { | 877 Future _assertSuccessfulRefactoring(String expectedCode) { |
| 877 return assertRefactoringConditionsOK().then((_) { | 878 return assertRefactoringConditionsOK().then((_) { |
| 878 return refactoring.createChange().then((SourceChange refactoringChange) { | 879 return refactoring.createChange().then((SourceChange refactoringChange) { |
| 879 this.refactoringChange = refactoringChange; | 880 this.refactoringChange = refactoringChange; |
| 880 assertTestChangeResult(expectedCode); | 881 assertTestChangeResult(expectedCode); |
| 881 }); | 882 }); |
| 882 }); | 883 }); |
| 883 } | 884 } |
| 884 | 885 |
| 885 void _createRefactoring(int offset, int length) { | 886 void _createRefactoring(int offset, int length) { |
| 886 refactoring = new ExtractLocalRefactoringImpl(testUnit, offset, length); | 887 refactoring = new ExtractLocalRefactoring(testUnit, offset, length); |
| 887 refactoring.name = 'res'; | 888 refactoring.name = 'res'; |
| 888 } | 889 } |
| 889 | 890 |
| 890 /** | 891 /** |
| 891 * Creates a new refactoring in [refactoring] for the selection range of the | 892 * Creates a new refactoring in [refactoring] for the selection range of the |
| 892 * given [search] pattern. | 893 * given [search] pattern. |
| 893 */ | 894 */ |
| 894 void _createRefactoringForString(String search) { | 895 void _createRefactoringForString(String search) { |
| 895 int offset = findOffset(search); | 896 int offset = findOffset(search); |
| 896 int length = search.length; | 897 int length = search.length; |
| 897 _createRefactoring(offset, length); | 898 _createRefactoring(offset, length); |
| 898 } | 899 } |
| 899 | 900 |
| 900 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { | 901 void _createRefactoringWithSuffix(String selectionSearch, String suffix) { |
| 901 int offset = findOffset(selectionSearch + suffix); | 902 int offset = findOffset(selectionSearch + suffix); |
| 902 int length = selectionSearch.length; | 903 int length = selectionSearch.length; |
| 903 _createRefactoring(offset, length); | 904 _createRefactoring(offset, length); |
| 904 } | 905 } |
| 905 } | 906 } |
| OLD | NEW |