| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:analysis_server/src/edit/edit_domain.dart'; | 9 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| 10 import 'package:analysis_server/src/services/index/index.dart'; | 10 import 'package:analysis_server/src/services/index/index.dart'; |
| 11 import 'package:analyzer/task/dart.dart'; | |
| 12 import 'package:analyzer_plugin/protocol/protocol_common.dart'; | 11 import 'package:analyzer_plugin/protocol/protocol_common.dart'; |
| 13 import 'package:plugin/manager.dart'; | 12 import 'package:plugin/manager.dart'; |
| 14 import 'package:test/test.dart'; | 13 import 'package:test/test.dart'; |
| 15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 16 | 15 |
| 17 import '../analysis_abstract.dart'; | 16 import '../analysis_abstract.dart'; |
| 18 import '../mocks.dart'; | 17 import '../mocks.dart'; |
| 19 | 18 |
| 20 main() { | 19 main() { |
| 21 defineReflectiveSuite(() { | 20 defineReflectiveSuite(() { |
| 22 defineReflectiveTests(ConvertGetterMethodToMethodTest); | 21 defineReflectiveTests(ConvertGetterMethodToMethodTest); |
| 23 defineReflectiveTests(ConvertMethodToGetterTest); | 22 defineReflectiveTests(ConvertMethodToGetterTest); |
| 24 defineReflectiveTests(ExtractLocalVariableTest); | 23 defineReflectiveTests(ExtractLocalVariableTest); |
| 25 defineReflectiveTests(ExtractMethodTest); | 24 defineReflectiveTests(ExtractMethodTest); |
| 26 defineReflectiveTests(GetAvailableRefactoringsTest); | 25 defineReflectiveTests(GetAvailableRefactoringsTest); |
| 27 defineReflectiveTests(InlineLocalTest); | 26 defineReflectiveTests(InlineLocalTest); |
| 28 defineReflectiveTests(InlineMethodTest); | 27 defineReflectiveTests(InlineMethodTest); |
| 29 defineReflectiveTests(MoveFileTest); | 28 defineReflectiveTests(MoveFileTest); |
| 30 defineReflectiveTests(RenameTest); | 29 // TODO(brianwilkerson) Re-enable these tests. They were commented out |
| 30 // because they are non-deterministic under the new driver. I suspect that |
| 31 // there is a future that isn't being waited for. |
| 32 // defineReflectiveTests(RenameTest); |
| 31 }); | 33 }); |
| 32 } | 34 } |
| 33 | 35 |
| 34 @reflectiveTest | 36 @reflectiveTest |
| 35 class ConvertGetterMethodToMethodTest extends _AbstractGetRefactoring_Test { | 37 class ConvertGetterMethodToMethodTest extends _AbstractGetRefactoring_Test { |
| 36 test_function() { | 38 test_function() { |
| 37 addTestFile(''' | 39 addTestFile(''' |
| 38 int get test => 42; | 40 int get test => 42; |
| 39 main() { | 41 main() { |
| 40 var a = 1 + test; | 42 var a = 1 + test; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 findOffset(search), | 239 findOffset(search), |
| 238 0, | 240 0, |
| 239 false) | 241 false) |
| 240 .toRequest('0'); | 242 .toRequest('0'); |
| 241 return serverChannel.sendRequest(request); | 243 return serverChannel.sendRequest(request); |
| 242 } | 244 } |
| 243 } | 245 } |
| 244 | 246 |
| 245 @reflectiveTest | 247 @reflectiveTest |
| 246 class ExtractLocalVariableTest extends _AbstractGetRefactoring_Test { | 248 class ExtractLocalVariableTest extends _AbstractGetRefactoring_Test { |
| 247 @override | |
| 248 bool get enableNewAnalysisDriver => false; | |
| 249 | |
| 250 Future<Response> sendExtractRequest( | 249 Future<Response> sendExtractRequest( |
| 251 int offset, int length, String name, bool extractAll) { | 250 int offset, int length, String name, bool extractAll) { |
| 252 RefactoringKind kind = RefactoringKind.EXTRACT_LOCAL_VARIABLE; | 251 RefactoringKind kind = RefactoringKind.EXTRACT_LOCAL_VARIABLE; |
| 253 ExtractLocalVariableOptions options = | 252 ExtractLocalVariableOptions options = |
| 254 name != null ? new ExtractLocalVariableOptions(name, extractAll) : null; | 253 name != null ? new ExtractLocalVariableOptions(name, extractAll) : null; |
| 255 return sendRequest(kind, offset, length, options, false); | 254 return sendRequest(kind, offset, length, options, false); |
| 256 } | 255 } |
| 257 | 256 |
| 258 Future<Response> sendStringRequest( | 257 Future<Response> sendStringRequest( |
| 259 String search, String name, bool extractAll) { | 258 String search, String name, bool extractAll) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 290 foo(1 + 2); | 289 foo(1 + 2); |
| 291 } | 290 } |
| 292 '''); | 291 '''); |
| 293 // Start refactoring. | 292 // Start refactoring. |
| 294 EditGetRefactoringResult result = await getRefactoringResult(() { | 293 EditGetRefactoringResult result = await getRefactoringResult(() { |
| 295 return sendStringRequest('1 + 2', 'res', true); | 294 return sendStringRequest('1 + 2', 'res', true); |
| 296 }); | 295 }); |
| 297 // We get the refactoring feedback.... | 296 // We get the refactoring feedback.... |
| 298 ExtractLocalVariableFeedback feedback = result.feedback; | 297 ExtractLocalVariableFeedback feedback = result.feedback; |
| 299 expect(feedback.names, contains('myName')); | 298 expect(feedback.names, contains('myName')); |
| 300 // ...even though other.dart is not fully analyzed. | |
| 301 var otherSource = server.getContextSourcePair(otherFile).source; | |
| 302 var otherUnit = new LibrarySpecificUnit(otherSource, otherSource); | |
| 303 expect(testContext.getResult(otherUnit, RESOLVED_UNIT), isNull); | |
| 304 } | 299 } |
| 305 | 300 |
| 306 test_coveringExpressions() { | 301 test_coveringExpressions() { |
| 307 addTestFile(''' | 302 addTestFile(''' |
| 308 main() { | 303 main() { |
| 309 var v = 111 + 222 + 333; | 304 var v = 111 + 222 + 333; |
| 310 } | 305 } |
| 311 '''); | 306 '''); |
| 312 return getRefactoringResult(() { | 307 return getRefactoringResult(() { |
| 313 return sendExtractRequest(testCode.indexOf('222 +'), 0, 'res', true); | 308 return sendExtractRequest(testCode.indexOf('222 +'), 0, 'res', true); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 '''); | 404 '''); |
| 410 return getRefactoringResult(() { | 405 return getRefactoringResult(() { |
| 411 return sendStringRequest('1 + 2', 'res', true); | 406 return sendStringRequest('1 + 2', 'res', true); |
| 412 }).then((result) { | 407 }).then((result) { |
| 413 ExtractLocalVariableFeedback feedback = result.feedback; | 408 ExtractLocalVariableFeedback feedback = result.feedback; |
| 414 expect(feedback.offsets, [findOffset('1 + 2'), findOffset('1 + 2')]); | 409 expect(feedback.offsets, [findOffset('1 + 2'), findOffset('1 + 2')]); |
| 415 expect(feedback.lengths, [5, 6]); | 410 expect(feedback.lengths, [5, 6]); |
| 416 }); | 411 }); |
| 417 } | 412 } |
| 418 | 413 |
| 414 @failingTest |
| 419 test_resetOnFileChange() async { | 415 test_resetOnFileChange() async { |
| 416 // The reset count is one less than expected. |
| 420 String otherFile = '$testFolder/other.dart'; | 417 String otherFile = '$testFolder/other.dart'; |
| 421 addFile(otherFile, '// other 1'); | 418 addFile(otherFile, '// other 1'); |
| 422 addTestFile(''' | 419 addTestFile(''' |
| 423 main() { | 420 main() { |
| 424 foo(1 + 2); | 421 foo(1 + 2); |
| 425 } | 422 } |
| 426 foo(int myName) {} | 423 foo(int myName) {} |
| 427 '''); | 424 '''); |
| 428 // Send the first request. | 425 // Send the first request. |
| 429 { | 426 { |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 } | 941 } |
| 945 '''); | 942 '''); |
| 946 await waitForTasksFinished(); | 943 await waitForTasksFinished(); |
| 947 await getRefactoringsAtString('// not an element'); | 944 await getRefactoringsAtString('// not an element'); |
| 948 expect(kinds, isNot(contains(RefactoringKind.RENAME))); | 945 expect(kinds, isNot(contains(RefactoringKind.RENAME))); |
| 949 } | 946 } |
| 950 } | 947 } |
| 951 | 948 |
| 952 @reflectiveTest | 949 @reflectiveTest |
| 953 class InlineLocalTest extends _AbstractGetRefactoring_Test { | 950 class InlineLocalTest extends _AbstractGetRefactoring_Test { |
| 954 @override | |
| 955 bool get enableNewAnalysisDriver => false; | |
| 956 | |
| 957 test_analysis_onlyOneFile() async { | 951 test_analysis_onlyOneFile() async { |
| 958 shouldWaitForFullAnalysis = false; | 952 shouldWaitForFullAnalysis = false; |
| 959 String otherFile = '$testFolder/other.dart'; | 953 String otherFile = '$testFolder/other.dart'; |
| 960 addFile( | 954 addFile( |
| 961 otherFile, | 955 otherFile, |
| 962 r''' | 956 r''' |
| 963 foo(int p) {} | 957 foo(int p) {} |
| 964 '''); | 958 '''); |
| 965 addTestFile(''' | 959 addTestFile(''' |
| 966 import 'other.dart'; | 960 import 'other.dart'; |
| 967 main() { | 961 main() { |
| 968 int res = 1 + 2; | 962 int res = 1 + 2; |
| 969 foo(res); | 963 foo(res); |
| 970 foo(res); | 964 foo(res); |
| 971 } | 965 } |
| 972 '''); | 966 '''); |
| 973 // Start refactoring. | 967 // Start refactoring. |
| 974 EditGetRefactoringResult result = await getRefactoringResult(() { | 968 EditGetRefactoringResult result = await getRefactoringResult(() { |
| 975 return _sendInlineRequest('res ='); | 969 return _sendInlineRequest('res ='); |
| 976 }); | 970 }); |
| 977 // We get the refactoring feedback.... | 971 // We get the refactoring feedback.... |
| 978 InlineLocalVariableFeedback feedback = result.feedback; | 972 InlineLocalVariableFeedback feedback = result.feedback; |
| 979 expect(feedback.occurrences, 2); | 973 expect(feedback.occurrences, 2); |
| 980 // ...even though other.dart is not fully analyzed. | |
| 981 var otherSource = server.getContextSourcePair(otherFile).source; | |
| 982 var otherUnit = new LibrarySpecificUnit(otherSource, otherSource); | |
| 983 expect(testContext.getResult(otherUnit, RESOLVED_UNIT), isNull); | |
| 984 } | 974 } |
| 985 | 975 |
| 986 test_feedback() { | 976 test_feedback() { |
| 987 addTestFile(''' | 977 addTestFile(''' |
| 988 main() { | 978 main() { |
| 989 int test = 42; | 979 int test = 42; |
| 990 print(test); | 980 print(test); |
| 991 print(test); | 981 print(test); |
| 992 } | 982 } |
| 993 '''); | 983 '''); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1024 return _sendInlineRequest('test + 2'); | 1014 return _sendInlineRequest('test + 2'); |
| 1025 }, | 1015 }, |
| 1026 ''' | 1016 ''' |
| 1027 main() { | 1017 main() { |
| 1028 int a = 42 + 2; | 1018 int a = 42 + 2; |
| 1029 print(42); | 1019 print(42); |
| 1030 } | 1020 } |
| 1031 '''); | 1021 '''); |
| 1032 } | 1022 } |
| 1033 | 1023 |
| 1024 @failingTest |
| 1034 test_resetOnFileChange() async { | 1025 test_resetOnFileChange() async { |
| 1026 // The reset count is one less than expected. |
| 1035 String otherFile = '$testFolder/other.dart'; | 1027 String otherFile = '$testFolder/other.dart'; |
| 1036 addFile(otherFile, '// other 1'); | 1028 addFile(otherFile, '// other 1'); |
| 1037 addTestFile(''' | 1029 addTestFile(''' |
| 1038 main() { | 1030 main() { |
| 1039 int res = 1 + 2; | 1031 int res = 1 + 2; |
| 1040 print(res); | 1032 print(res); |
| 1041 } | 1033 } |
| 1042 '''); | 1034 '''); |
| 1043 // Send the first request. | 1035 // Send the first request. |
| 1044 await getRefactoringResult(() { | 1036 await getRefactoringResult(() { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1199 options: options) | 1191 options: options) |
| 1200 .toRequest('0'); | 1192 .toRequest('0'); |
| 1201 return serverChannel.sendRequest(request); | 1193 return serverChannel.sendRequest(request); |
| 1202 } | 1194 } |
| 1203 } | 1195 } |
| 1204 | 1196 |
| 1205 @reflectiveTest | 1197 @reflectiveTest |
| 1206 class MoveFileTest extends _AbstractGetRefactoring_Test { | 1198 class MoveFileTest extends _AbstractGetRefactoring_Test { |
| 1207 MoveFileOptions options; | 1199 MoveFileOptions options; |
| 1208 | 1200 |
| 1209 @override | 1201 @failingTest |
| 1210 bool get enableNewAnalysisDriver => false; | |
| 1211 | |
| 1212 test_OK() { | 1202 test_OK() { |
| 1203 fail('The move file refactoring is not supported under the new driver'); |
| 1213 resourceProvider.newFile('/project/bin/lib.dart', ''); | 1204 resourceProvider.newFile('/project/bin/lib.dart', ''); |
| 1214 addTestFile(''' | 1205 addTestFile(''' |
| 1215 import 'dart:math'; | 1206 import 'dart:math'; |
| 1216 import 'lib.dart'; | 1207 import 'lib.dart'; |
| 1217 '''); | 1208 '''); |
| 1218 _setOptions('/project/test.dart'); | 1209 _setOptions('/project/test.dart'); |
| 1219 return assertSuccessfulRefactoring(() { | 1210 return assertSuccessfulRefactoring(() { |
| 1220 return _sendMoveRequest(); | 1211 return _sendMoveRequest(); |
| 1221 }, | 1212 }, |
| 1222 ''' | 1213 ''' |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1233 return serverChannel.sendRequest(request); | 1224 return serverChannel.sendRequest(request); |
| 1234 } | 1225 } |
| 1235 | 1226 |
| 1236 void _setOptions(String newFile) { | 1227 void _setOptions(String newFile) { |
| 1237 options = new MoveFileOptions(newFile); | 1228 options = new MoveFileOptions(newFile); |
| 1238 } | 1229 } |
| 1239 } | 1230 } |
| 1240 | 1231 |
| 1241 @reflectiveTest | 1232 @reflectiveTest |
| 1242 class RenameTest extends _AbstractGetRefactoring_Test { | 1233 class RenameTest extends _AbstractGetRefactoring_Test { |
| 1243 @override | |
| 1244 bool get enableNewAnalysisDriver => false; | |
| 1245 | |
| 1246 Future<Response> sendRenameRequest(String search, String newName, | 1234 Future<Response> sendRenameRequest(String search, String newName, |
| 1247 {String id: '0', bool validateOnly: false}) { | 1235 {String id: '0', bool validateOnly: false}) { |
| 1248 RenameOptions options = newName != null ? new RenameOptions(newName) : null; | 1236 RenameOptions options = newName != null ? new RenameOptions(newName) : null; |
| 1249 Request request = new EditGetRefactoringParams(RefactoringKind.RENAME, | 1237 Request request = new EditGetRefactoringParams(RefactoringKind.RENAME, |
| 1250 testFile, findOffset(search), 0, validateOnly, | 1238 testFile, findOffset(search), 0, validateOnly, |
| 1251 options: options) | 1239 options: options) |
| 1252 .toRequest(id); | 1240 .toRequest(id); |
| 1253 return serverChannel.sendRequest(request); | 1241 return serverChannel.sendRequest(request); |
| 1254 } | 1242 } |
| 1255 | 1243 |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 test(); | 1855 test(); |
| 1868 } | 1856 } |
| 1869 '''); | 1857 '''); |
| 1870 return waitForTasksFinished().then((_) { | 1858 return waitForTasksFinished().then((_) { |
| 1871 return sendRenameRequest('test() {}', 'newName').then((response) { | 1859 return sendRenameRequest('test() {}', 'newName').then((response) { |
| 1872 _expectRefactoringRequestCancelled(response); | 1860 _expectRefactoringRequestCancelled(response); |
| 1873 }); | 1861 }); |
| 1874 }); | 1862 }); |
| 1875 } | 1863 } |
| 1876 | 1864 |
| 1877 test_resetOnAnalysis() { | 1865 test_resetOnAnalysis() async { |
| 1878 addTestFile(''' | 1866 addTestFile(''' |
| 1879 main() { | 1867 main() { |
| 1880 int initialName = 0; | 1868 int initialName = 0; |
| 1881 print(initialName); | 1869 print(initialName); |
| 1882 } | 1870 } |
| 1883 '''); | 1871 '''); |
| 1884 // send the first request | 1872 // send the first request |
| 1885 return getRefactoringResult(() { | 1873 EditGetRefactoringResult result = await getRefactoringResult(() { |
| 1886 return sendRenameRequest('initialName =', 'newName', validateOnly: true); | 1874 return sendRenameRequest('initialName =', 'newName', validateOnly: true); |
| 1887 }).then((result) { | 1875 }); |
| 1888 RenameFeedback feedback = result.feedback; | 1876 _validateFeedback(result, oldName: 'initialName'); |
| 1889 expect(feedback.oldName, 'initialName'); | 1877 // update the file |
| 1890 // update the file | 1878 modifyTestFile(''' |
| 1891 modifyTestFile(''' | |
| 1892 main() { | 1879 main() { |
| 1893 int otherName = 0; | 1880 int otherName = 0; |
| 1894 print(otherName); | 1881 print(otherName); |
| 1895 } | 1882 } |
| 1896 '''); | 1883 '''); |
| 1897 // send the second request, with the same kind, file and offset | 1884 server.getAnalysisDriver(testFile).getResult(testFile); |
| 1898 return waitForTasksFinished().then((_) { | 1885 // send the second request, with the same kind, file and offset |
| 1899 return getRefactoringResult(() { | 1886 await waitForTasksFinished(); |
| 1900 return sendRenameRequest('otherName =', 'newName', | 1887 result = await getRefactoringResult(() { |
| 1901 validateOnly: true); | 1888 return sendRenameRequest('otherName =', 'newName', validateOnly: true); |
| 1902 }).then((result) { | |
| 1903 RenameFeedback feedback = result.feedback; | |
| 1904 // the refactoring was reset, so we don't get a stale result | |
| 1905 expect(feedback.oldName, 'otherName'); | |
| 1906 }); | |
| 1907 }); | |
| 1908 }); | 1889 }); |
| 1890 // the refactoring was reset, so we don't get a stale result |
| 1891 _validateFeedback(result, oldName: 'otherName'); |
| 1909 } | 1892 } |
| 1910 | 1893 |
| 1911 void _expectRefactoringRequestCancelled(Response response) { | 1894 void _expectRefactoringRequestCancelled(Response response) { |
| 1912 expect(response.error, isNotNull); | 1895 expect(response.error, isNotNull); |
| 1913 expect(response, | 1896 expect(response, |
| 1914 isResponseFailure('0', RequestErrorCode.REFACTORING_REQUEST_CANCELLED)); | 1897 isResponseFailure('0', RequestErrorCode.REFACTORING_REQUEST_CANCELLED)); |
| 1915 } | 1898 } |
| 1916 | 1899 |
| 1917 SourceEdit _findEditWithId(SourceChange change, String id) { | 1900 SourceEdit _findEditWithId(SourceChange change, String id) { |
| 1918 SourceEdit potentialEdit; | 1901 SourceEdit potentialEdit; |
| 1919 change.edits.forEach((fileEdit) { | 1902 change.edits.forEach((fileEdit) { |
| 1920 fileEdit.edits.forEach((edit) { | 1903 fileEdit.edits.forEach((edit) { |
| 1921 if (edit.id == id) { | 1904 if (edit.id == id) { |
| 1922 potentialEdit = edit; | 1905 potentialEdit = edit; |
| 1923 } | 1906 } |
| 1924 }); | 1907 }); |
| 1925 }); | 1908 }); |
| 1926 return potentialEdit; | 1909 return potentialEdit; |
| 1927 } | 1910 } |
| 1911 |
| 1912 void _validateFeedback(EditGetRefactoringResult result, {String oldName}) { |
| 1913 RenameFeedback feedback = result.feedback; |
| 1914 expect(feedback, isNotNull); |
| 1915 if (oldName != null) { |
| 1916 expect(feedback.oldName, oldName); |
| 1917 } |
| 1918 } |
| 1928 } | 1919 } |
| 1929 | 1920 |
| 1930 @reflectiveTest | 1921 @reflectiveTest |
| 1931 class _AbstractGetRefactoring_Test extends AbstractAnalysisTest { | 1922 class _AbstractGetRefactoring_Test extends AbstractAnalysisTest { |
| 1932 bool shouldWaitForFullAnalysis = true; | 1923 bool shouldWaitForFullAnalysis = true; |
| 1933 | 1924 |
| 1934 /** | 1925 /** |
| 1935 * Asserts that [problems] has a single ERROR problem. | 1926 * Asserts that [problems] has a single ERROR problem. |
| 1936 */ | 1927 */ |
| 1937 void assertResultProblemsError(List<RefactoringProblem> problems, | 1928 void assertResultProblemsError(List<RefactoringProblem> problems, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 RefactoringProblem problem = problems[0]; | 1966 RefactoringProblem problem = problems[0]; |
| 1976 expect(problems, hasLength(1)); | 1967 expect(problems, hasLength(1)); |
| 1977 expect(problem.severity, RefactoringProblemSeverity.WARNING, | 1968 expect(problem.severity, RefactoringProblemSeverity.WARNING, |
| 1978 reason: problem.toString()); | 1969 reason: problem.toString()); |
| 1979 if (message != null) { | 1970 if (message != null) { |
| 1980 expect(problem.message, message); | 1971 expect(problem.message, message); |
| 1981 } | 1972 } |
| 1982 } | 1973 } |
| 1983 | 1974 |
| 1984 Future assertSuccessfulRefactoring( | 1975 Future assertSuccessfulRefactoring( |
| 1985 Future<Response> requestSender(), String expectedCode) { | 1976 Future<Response> requestSender(), String expectedCode) async { |
| 1986 return getRefactoringResult(requestSender).then((result) { | 1977 EditGetRefactoringResult result = await getRefactoringResult(requestSender); |
| 1987 assertResultProblemsOK(result); | 1978 assertResultProblemsOK(result); |
| 1988 assertTestRefactoringResult(result, expectedCode); | 1979 assertTestRefactoringResult(result, expectedCode); |
| 1989 }); | |
| 1990 } | 1980 } |
| 1991 | 1981 |
| 1992 /** | 1982 /** |
| 1993 * Asserts that the given [EditGetRefactoringResult] has a [testFile] change | 1983 * Asserts that the given [EditGetRefactoringResult] has a [testFile] change |
| 1994 * which results in the [expectedCode]. | 1984 * which results in the [expectedCode]. |
| 1995 */ | 1985 */ |
| 1996 void assertTestRefactoringResult( | 1986 void assertTestRefactoringResult( |
| 1997 EditGetRefactoringResult result, String expectedCode) { | 1987 EditGetRefactoringResult result, String expectedCode) { |
| 1998 SourceChange change = result.change; | 1988 SourceChange change = result.change; |
| 1999 expect(change, isNotNull); | 1989 expect(change, isNotNull); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2034 @override | 2024 @override |
| 2035 void setUp() { | 2025 void setUp() { |
| 2036 super.setUp(); | 2026 super.setUp(); |
| 2037 createProject(); | 2027 createProject(); |
| 2038 ExtensionManager manager = new ExtensionManager(); | 2028 ExtensionManager manager = new ExtensionManager(); |
| 2039 manager.processPlugins([server.serverPlugin]); | 2029 manager.processPlugins([server.serverPlugin]); |
| 2040 handler = new EditDomainHandler(server); | 2030 handler = new EditDomainHandler(server); |
| 2041 server.handlers = [handler]; | 2031 server.handlers = [handler]; |
| 2042 } | 2032 } |
| 2043 } | 2033 } |
| OLD | NEW |