| 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.completion.toplevel; | 5 library test.services.completion.toplevel; |
| 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/completion/completion_manager.dart'
; | 8 import 'package:analysis_server/src/services/completion/completion_manager.dart'
; |
| 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; | 9 import 'package:analysis_server/src/services/completion/dart_completion_cache.da
rt'; |
| 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; | 10 import 'package:analysis_server/src/services/completion/dart_completion_manager.
dart'; |
| 11 import 'package:analysis_server/src/services/completion/imported_computer.dart'; | 11 import 'package:analysis_server/src/services/completion/imported_computer.dart'; |
| 12 import 'package:analyzer/src/generated/ast.dart'; | 12 import 'package:analyzer/src/generated/ast.dart'; |
| 13 import 'package:analyzer/src/generated/element.dart'; | 13 import 'package:analyzer/src/generated/element.dart'; |
| 14 import 'package:analyzer/src/generated/engine.dart'; | 14 import 'package:analyzer/src/generated/engine.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:unittest/unittest.dart'; | 16 import 'package:unittest/unittest.dart'; |
| 17 | 17 |
| 18 import '../../abstract_context.dart'; | 18 import '../../abstract_context.dart'; |
| 19 import '../../reflective_tests.dart'; | 19 import '../../reflective_tests.dart'; |
| 20 import 'completion_test_util.dart'; | 20 import 'completion_test_util.dart'; |
| 21 | 21 |
| 22 main() { | 22 main() { |
| 23 groupSep = ' | '; | 23 groupSep = ' | '; |
| 24 runReflectiveTests(ImportedComputerTest); | 24 runReflectiveTests(ImportedComputerTest); |
| 25 } | 25 } |
| 26 | 26 |
| 27 @ReflectiveTestCase() | 27 @ReflectiveTestCase() |
| 28 class ImportedComputerTest extends AbstractSelectorSuggestionTest { | 28 class ImportedComputerTest extends AbstractSelectorSuggestionTest { |
| 29 | 29 |
| 30 @override |
| 31 CompletionSuggestion assertSuggestImportedField(String name, String type, [int
relevance = |
| 32 COMPLETION_RELEVANCE_DEFAULT]) { |
| 33 return assertSuggestField(name, type, relevance: relevance); |
| 34 } |
| 35 |
| 30 void assertCached(String completion) { | 36 void assertCached(String completion) { |
| 31 DartCompletionCache cache = request.cache; | 37 DartCompletionCache cache = request.cache; |
| 32 if (!isCached(cache.importedTypeSuggestions, completion) && | 38 if (!isCached(cache.importedTypeSuggestions, completion) && |
| 33 !isCached(cache.importedVoidReturnSuggestions, completion) && | 39 !isCached(cache.importedVoidReturnSuggestions, completion) && |
| 34 !isCached(cache.libraryPrefixSuggestions, completion) && | 40 !isCached(cache.libraryPrefixSuggestions, completion) && |
| 35 !isCached(cache.otherImportedSuggestions, completion)) { | 41 !isCached(cache.otherImportedSuggestions, completion)) { |
| 36 fail('expected $completion to be cached'); | 42 fail('expected $completion to be cached'); |
| 37 } | 43 } |
| 38 } | 44 } |
| 39 | 45 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 262 |
| 257 @override | 263 @override |
| 258 test_partFile_TypeName2() { | 264 test_partFile_TypeName2() { |
| 259 return super.test_partFile_TypeName2().then((_) { | 265 return super.test_partFile_TypeName2().then((_) { |
| 260 expect( | 266 expect( |
| 261 request.cache.importKey, | 267 request.cache.importKey, |
| 262 'library libA;import "/testB.dart";part "/testA.dart";'); | 268 'library libA;import "/testB.dart";part "/testA.dart";'); |
| 263 }); | 269 }); |
| 264 } | 270 } |
| 265 } | 271 } |
| OLD | NEW |