| Index: pkg/analysis_server/test/completion_test_support.dart
|
| diff --git a/pkg/analysis_server/test/completion_test_support.dart b/pkg/analysis_server/test/completion_test_support.dart
|
| index bca1b38b44361644c1212c0164950b2c567fb31d..3d4157a040f820f88a518f3bb32ea627664e1c5c 100644
|
| --- a/pkg/analysis_server/test/completion_test_support.dart
|
| +++ b/pkg/analysis_server/test/completion_test_support.dart
|
| @@ -4,6 +4,7 @@
|
|
|
| library test.completion.support;
|
|
|
| +import 'dart:async';
|
| import 'dart:collection';
|
|
|
| import 'package:analysis_server/src/protocol.dart';
|
| @@ -11,7 +12,6 @@ import 'package:analyzer/src/generated/java_core.dart';
|
| import 'package:unittest/unittest.dart';
|
|
|
| import 'domain_completion_test.dart';
|
| -import 'dart:async';
|
|
|
| /**
|
| * A base class for classes containing completion tests.
|
| @@ -53,9 +53,6 @@ class CompletionTestCase extends CompletionTest {
|
| }
|
|
|
| void assertHasNoCompletion(String completion) {
|
| - // As a temporary measure, disable negative tests.
|
| - // TODO(paulberry): fix this.
|
| - return;
|
| if (suggestions.any(
|
| (CompletionSuggestion suggestion) => suggestion.completion == completion)) {
|
| fail(
|
| @@ -63,6 +60,18 @@ class CompletionTestCase extends CompletionTest {
|
| }
|
| }
|
|
|
| + /**
|
| + * Discard any results that do not start with the characters the user has
|
| + * "already typed".
|
| + */
|
| + void filterResults(String content) {
|
| + String charsAlreadyTyped =
|
| + content.substring(replacementOffset, completionOffset).toLowerCase();
|
| + suggestions = suggestions.where(
|
| + (CompletionSuggestion suggestion) =>
|
| + suggestion.completion.toLowerCase().startsWith(charsAlreadyTyped)).toList();
|
| + }
|
| +
|
| runTest(LocationSpec spec, [Map<String, String> extraFiles]) {
|
| super.setUp();
|
| return new Future(() {
|
| @@ -76,8 +85,7 @@ class CompletionTestCase extends CompletionTest {
|
| });
|
| }
|
| }).then((_) => getSuggestions()).then((_) {
|
| - //expect(replacementOffset, equals(completionOffset));
|
| - //expect(replacementLength, equals(0));
|
| + filterResults(spec.source);
|
| for (String result in spec.positiveResults) {
|
| assertHasCompletion(result);
|
| }
|
|
|