| 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.edit.refactoring; | 5 library test.edit.refactoring; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 10 import 'package:analysis_server/src/edit/edit_domain.dart'; | 10 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 }, | 307 }, |
| 308 ''' | 308 ''' |
| 309 main() { | 309 main() { |
| 310 var res = 1 + 2; | 310 var res = 1 + 2; |
| 311 print(res); | 311 print(res); |
| 312 print(res); | 312 print(res); |
| 313 } | 313 } |
| 314 '''); | 314 '''); |
| 315 } | 315 } |
| 316 | 316 |
| 317 solo_test_extractAll_string() { |
| 318 addTestFile(''' |
| 319 main() { |
| 320 print("foo"); |
| 321 } |
| 322 '''); |
| 323 return assertSuccessfulRefactoring(() { |
| 324 return sendStringRequest('oo"', 'res', true); |
| 325 }, |
| 326 ''' |
| 327 main() { |
| 328 var res = "foo"; |
| 329 print(res); |
| 330 } |
| 331 '''); |
| 332 } |
| 333 |
| 317 test_extractOne() { | 334 test_extractOne() { |
| 318 addTestFile(''' | 335 addTestFile(''' |
| 319 main() { | 336 main() { |
| 320 print(1 + 2); | 337 print(1 + 2); |
| 321 print(1 + 2); // marker | 338 print(1 + 2); // marker |
| 322 } | 339 } |
| 323 '''); | 340 '''); |
| 324 return assertSuccessfulRefactoring(() { | 341 return assertSuccessfulRefactoring(() { |
| 325 return sendStringSuffixRequest('1 + 2', '); // marker', 'res', false); | 342 return sendStringSuffixRequest('1 + 2', '); // marker', 'res', false); |
| 326 }, | 343 }, |
| (...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 .toRequest('0'); | 1933 .toRequest('0'); |
| 1917 return _assertErrorResponseNoIndex(request); | 1934 return _assertErrorResponseNoIndex(request); |
| 1918 } | 1935 } |
| 1919 | 1936 |
| 1920 _assertErrorResponseNoIndex(Request request) async { | 1937 _assertErrorResponseNoIndex(Request request) async { |
| 1921 Response response = await serverChannel.sendRequest(request); | 1938 Response response = await serverChannel.sendRequest(request); |
| 1922 expect(response.error, isNotNull); | 1939 expect(response.error, isNotNull); |
| 1923 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); | 1940 expect(response.error.code, RequestErrorCode.NO_INDEX_GENERATED); |
| 1924 } | 1941 } |
| 1925 } | 1942 } |
| OLD | NEW |