| 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_OK_hasUnresolvedIdentifier() { |
| 915 _indexTestUnit(''' |
| 916 import 'dart:math'; |
| 917 main(x) { |
| 918 PI; |
| 919 return x.foo(); |
| 920 } |
| 921 '''); |
| 922 assertHasAssistAt('import ', AssistKind.IMPORT_ADD_SHOW, ''' |
| 923 import 'dart:math' show PI; |
| 924 main(x) { |
| 925 PI; |
| 926 return x.foo(); |
| 927 } |
| 928 '''); |
| 929 } |
| 930 |
| 914 void test_importAddShow_OK_onDirective() { | 931 void test_importAddShow_OK_onDirective() { |
| 915 _indexTestUnit(''' | 932 _indexTestUnit(''' |
| 916 import 'dart:math'; | 933 import 'dart:math'; |
| 917 main() { | 934 main() { |
| 918 PI; | 935 PI; |
| 919 E; | 936 E; |
| 920 max(1, 2); | 937 max(1, 2); |
| 921 } | 938 } |
| 922 '''); | 939 '''); |
| 923 assertHasAssistAt('import ', AssistKind.IMPORT_ADD_SHOW, ''' | 940 assertHasAssistAt('import ', AssistKind.IMPORT_ADD_SHOW, ''' |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2218 void _indexTestUnit(String code) { | 2235 void _indexTestUnit(String code) { |
| 2219 resolveTestUnit(code); | 2236 resolveTestUnit(code); |
| 2220 index.indexUnit(context, testUnit); | 2237 index.indexUnit(context, testUnit); |
| 2221 } | 2238 } |
| 2222 | 2239 |
| 2223 void _setStartEndSelection() { | 2240 void _setStartEndSelection() { |
| 2224 offset = findOffset('// start\n') + '// start\n'.length; | 2241 offset = findOffset('// start\n') + '// start\n'.length; |
| 2225 length = findOffset('// end') - offset; | 2242 length = findOffset('// end') - offset; |
| 2226 } | 2243 } |
| 2227 } | 2244 } |
| OLD | NEW |