| 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.dart.manager; | 5 library test.services.completion.dart.manager; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 9 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 10 import 'package:analysis_server/src/services/completion/completion_core.dart'; | 10 import 'package:analysis_server/src/services/completion/completion_core.dart'; |
| 11 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; | 11 import 'package:analysis_server/src/services/completion/completion_performance.d
art'; |
| 12 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; | 12 import 'package:analysis_server/src/services/completion/dart/completion_manager.
dart'; |
| 13 import 'package:analysis_server/src/services/completion/dart/imported_reference_
contributor.dart'; | 13 import 'package:analysis_server/src/services/completion/dart/imported_reference_
contributor.dart'; |
| 14 import 'package:analyzer/dart/element/element.dart'; | 14 import 'package:analyzer/dart/element/element.dart'; |
| 15 import 'package:analyzer/src/task/dart.dart'; | 15 import 'package:analyzer/src/task/dart.dart'; |
| 16 import 'package:test/test.dart'; |
| 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 17 import 'package:unittest/unittest.dart'; | |
| 18 | 18 |
| 19 import '../../../utils.dart'; | 19 import '../../../utils.dart'; |
| 20 import 'completion_contributor_util.dart'; | 20 import 'completion_contributor_util.dart'; |
| 21 | 21 |
| 22 main() { | 22 main() { |
| 23 initializeTestEnvironment(); | 23 initializeTestEnvironment(); |
| 24 defineReflectiveTests(CompletionManagerTest); | 24 defineReflectiveSuite(() { |
| 25 defineReflectiveTests(CompletionManagerTest); |
| 26 }); |
| 25 } | 27 } |
| 26 | 28 |
| 27 @reflectiveTest | 29 @reflectiveTest |
| 28 class CompletionManagerTest extends DartCompletionContributorTest { | 30 class CompletionManagerTest extends DartCompletionContributorTest { |
| 29 @override | 31 @override |
| 30 DartCompletionContributor createContributor() { | 32 DartCompletionContributor createContributor() { |
| 31 return new ImportedReferenceContributor(); | 33 return new ImportedReferenceContributor(); |
| 32 } | 34 } |
| 33 | 35 |
| 34 test_resolveDirectives() async { | 36 test_resolveDirectives() async { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 }); | 86 }); |
| 85 List<ImportElement> imports = await performAnalysis(200, importCompleter); | 87 List<ImportElement> imports = await performAnalysis(200, importCompleter); |
| 86 expect(imports, hasLength(directives.length + 1)); | 88 expect(imports, hasLength(directives.length + 1)); |
| 87 | 89 |
| 88 ImportElement importNamed(String expectedUri) { | 90 ImportElement importNamed(String expectedUri) { |
| 89 return imports.firstWhere((elem) => elem.uri == expectedUri, orElse: () { | 91 return imports.firstWhere((elem) => elem.uri == expectedUri, orElse: () { |
| 90 var importedNames = imports.map((elem) => elem.uri); | 92 var importedNames = imports.map((elem) => elem.uri); |
| 91 fail('Failed to find $expectedUri in $importedNames'); | 93 fail('Failed to find $expectedUri in $importedNames'); |
| 92 }); | 94 }); |
| 93 } | 95 } |
| 96 |
| 94 void assertImportedLib(String expectedUri) { | 97 void assertImportedLib(String expectedUri) { |
| 95 ImportElement importElem = importNamed(expectedUri); | 98 ImportElement importElem = importNamed(expectedUri); |
| 96 expect(importElem.importedLibrary.exportNamespace, isNotNull); | 99 expect(importElem.importedLibrary.exportNamespace, isNotNull); |
| 97 } | 100 } |
| 98 | 101 |
| 99 // Assert that the new imports each have an export namespace | 102 // Assert that the new imports each have an export namespace |
| 100 assertImportedLib(null /* dart:core */); | 103 assertImportedLib(null /* dart:core */); |
| 101 assertImportedLib('/libA.dart'); | 104 assertImportedLib('/libA.dart'); |
| 102 } | 105 } |
| 103 } | 106 } |
| OLD | NEW |