| Index: pkg/analysis_server/test/services/completion/imported_computer_test.dart
|
| diff --git a/pkg/analysis_server/test/services/completion/imported_computer_test.dart b/pkg/analysis_server/test/services/completion/imported_computer_test.dart
|
| index 80b23678e0e0871dc3dccc64b8db0458816aa94a..6c5e95444c77a6df95a8c2b32c64aa8e95975729 100644
|
| --- a/pkg/analysis_server/test/services/completion/imported_computer_test.dart
|
| +++ b/pkg/analysis_server/test/services/completion/imported_computer_test.dart
|
| @@ -9,6 +9,9 @@ import 'package:unittest/unittest.dart';
|
|
|
| import '../../reflective_tests.dart';
|
| import 'completion_test_util.dart';
|
| +import 'package:analysis_server/src/protocol.dart';
|
| +import 'package:analyzer/src/generated/engine.dart';
|
| +import 'package:analysis_server/src/services/completion/dart_completion_manager.dart';
|
|
|
| main() {
|
| groupSep = ' | ';
|
| @@ -19,8 +22,67 @@ main() {
|
| class ImportedTypeComputerTest extends AbstractSelectorSuggestionTest {
|
|
|
| @override
|
| - void setUp() {
|
| - super.setUp();
|
| + void setUpComputer() {
|
| computer = new ImportedComputer();
|
| }
|
| +
|
| + /**
|
| + * Assert that the ImportedComputer uses cached results to produce identical
|
| + * suggestions to the original set of suggestions.
|
| + */
|
| + void assertCachedCompute(_) {
|
| + expect(request.unit.element, isNotNull);
|
| + List<CompletionSuggestion> oldSuggestions = request.suggestions;
|
| + /*
|
| + * Simulate a source change to flush the cached compilation unit
|
| + */
|
| + ChangeSet changes = new ChangeSet();
|
| + changes.addedSource(testSource);
|
| + context.applyChanges(changes);
|
| + /*
|
| + * Calculate a new completion at the same location
|
| + */
|
| + setUpComputer();
|
| + request = new DartCompletionRequest(
|
| + context,
|
| + searchEngine,
|
| + testSource,
|
| + completionOffset,
|
| + cache);
|
| + expect(computeFast(), isTrue);
|
| + expect(request.unit.element, isNull);
|
| + List<CompletionSuggestion> newSuggestions = request.suggestions;
|
| + expect(newSuggestions.length, oldSuggestions.length);
|
| + oldSuggestions.forEach((CompletionSuggestion s) {
|
| + expect(newSuggestions.contains(s), isTrue);
|
| + });
|
| + }
|
| +
|
| + @override
|
| + test_ArgumentList() {
|
| + return super.test_ArgumentList().then((_) {
|
| + expect(request.cache.importKey, "import '/libA.dart';");
|
| + });
|
| + }
|
| +
|
| + @override
|
| + test_ArgumentList_imported_function() {
|
| + return super.test_ArgumentList_imported_function().then((_) {
|
| + expect(request.cache.importKey, "import '/libA.dart';");
|
| + });
|
| + }
|
| +
|
| + @override
|
| + test_AssignmentExpression_RHS() {
|
| + return super.test_AssignmentExpression_RHS().then((_) {
|
| + expect(request.cache.importKey, '');
|
| + });
|
| + }
|
| +
|
| + @override
|
| + test_Block() {
|
| + return super.test_Block().then((_) {
|
| + expect(request.cache.importKey, 'import "/testAB.dart";import "/testCD.dart" hide D;import "/testEEF.dart" show EE;import "/testG.dart" as g;');
|
| + });
|
| + }
|
| }
|
|
|