| 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 assertNoAssistAt('import ', AssistKind.IMPORT_ADD_SHOW); | 904 assertNoAssistAt('import ', AssistKind.IMPORT_ADD_SHOW); |
| 905 } | 905 } |
| 906 | 906 |
| 907 void test_importAddShow_BAD_unused() { | 907 void test_importAddShow_BAD_unused() { |
| 908 _indexTestUnit(''' | 908 _indexTestUnit(''' |
| 909 import 'dart:math'; | 909 import 'dart:math'; |
| 910 '''); | 910 '''); |
| 911 assertNoAssistAt('import ', AssistKind.IMPORT_ADD_SHOW); | 911 assertNoAssistAt('import ', AssistKind.IMPORT_ADD_SHOW); |
| 912 } | 912 } |
| 913 | 913 |
| 914 void test_importAddShow_BAD_unresolvedUri() { |
| 915 _indexTestUnit(''' |
| 916 import '/no/such/lib.dart'; |
| 917 '''); |
| 918 assertNoAssistAt('import ', AssistKind.IMPORT_ADD_SHOW); |
| 919 } |
| 920 |
| 914 void test_importAddShow_OK_hasUnresolvedIdentifier() { | 921 void test_importAddShow_OK_hasUnresolvedIdentifier() { |
| 915 _indexTestUnit(''' | 922 _indexTestUnit(''' |
| 916 import 'dart:math'; | 923 import 'dart:math'; |
| 917 main(x) { | 924 main(x) { |
| 918 PI; | 925 PI; |
| 919 return x.foo(); | 926 return x.foo(); |
| 920 } | 927 } |
| 921 '''); | 928 '''); |
| 922 assertHasAssistAt('import ', AssistKind.IMPORT_ADD_SHOW, ''' | 929 assertHasAssistAt('import ', AssistKind.IMPORT_ADD_SHOW, ''' |
| 923 import 'dart:math' show PI; | 930 import 'dart:math' show PI; |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 void _indexTestUnit(String code) { | 2242 void _indexTestUnit(String code) { |
| 2236 resolveTestUnit(code); | 2243 resolveTestUnit(code); |
| 2237 index.indexUnit(context, testUnit); | 2244 index.indexUnit(context, testUnit); |
| 2238 } | 2245 } |
| 2239 | 2246 |
| 2240 void _setStartEndSelection() { | 2247 void _setStartEndSelection() { |
| 2241 offset = findOffset('// start\n') + '// start\n'.length; | 2248 offset = findOffset('// start\n') + '// start\n'.length; |
| 2242 length = findOffset('// end') - offset; | 2249 length = findOffset('// end') - offset; |
| 2243 } | 2250 } |
| 2244 } | 2251 } |
| OLD | NEW |