| 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.correction.assist; | 5 library test.services.correction.assist; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
| 8 import 'package:analysis_server/src/services/correction/assist.dart'; | 8 import 'package:analysis_server/src/services/correction/assist.dart'; |
| 9 import 'package:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
| 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 assertHasAssistAt( | 1368 assertHasAssistAt( |
| 1369 'is String', | 1369 'is String', |
| 1370 AssistKind.INTRODUCE_LOCAL_CAST_TYPE, | 1370 AssistKind.INTRODUCE_LOCAL_CAST_TYPE, |
| 1371 expected); | 1371 expected); |
| 1372 assertHasAssistAt( | 1372 assertHasAssistAt( |
| 1373 'while (p', | 1373 'while (p', |
| 1374 AssistKind.INTRODUCE_LOCAL_CAST_TYPE, | 1374 AssistKind.INTRODUCE_LOCAL_CAST_TYPE, |
| 1375 expected); | 1375 expected); |
| 1376 } | 1376 } |
| 1377 | 1377 |
| 1378 void test_invalidSelection() { |
| 1379 _indexTestUnit(''); |
| 1380 List<Assist> assists = computeAssists(searchEngine, testUnit, -1, 0); |
| 1381 expect(assists, isEmpty); |
| 1382 } |
| 1383 |
| 1378 void test_invertIfStatement_blocks() { | 1384 void test_invertIfStatement_blocks() { |
| 1379 _indexTestUnit(''' | 1385 _indexTestUnit(''' |
| 1380 main() { | 1386 main() { |
| 1381 if (true) { | 1387 if (true) { |
| 1382 0; | 1388 0; |
| 1383 } else { | 1389 } else { |
| 1384 1; | 1390 1; |
| 1385 } | 1391 } |
| 1386 } | 1392 } |
| 1387 '''); | 1393 '''); |
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2621 void _indexTestUnit(String code) { | 2627 void _indexTestUnit(String code) { |
| 2622 resolveTestUnit(code); | 2628 resolveTestUnit(code); |
| 2623 index.indexUnit(context, testUnit); | 2629 index.indexUnit(context, testUnit); |
| 2624 } | 2630 } |
| 2625 | 2631 |
| 2626 void _setStartEndSelection() { | 2632 void _setStartEndSelection() { |
| 2627 offset = findOffset('// start\n') + '// start\n'.length; | 2633 offset = findOffset('// start\n') + '// start\n'.length; |
| 2628 length = findOffset('// end') - offset; | 2634 length = findOffset('// end') - offset; |
| 2629 } | 2635 } |
| 2630 } | 2636 } |
| OLD | NEW |