Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 882273002: tests for earlier CL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/completion/completion_test_util.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index 53a329c0fe487df8f42910f2b00aad182a463fb5..412d92a1957f927266cd163c6c15648706a5f406 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -492,9 +492,8 @@ abstract class AbstractCompletionTest extends AbstractContextTest {
cache,
[computer]);
var result = _completionManager.computeFast(request);
- if (request.replacementOffset == null) {
- fail('expected non null');
- }
+ expect(request.replacementOffset, isNotNull);
+ expect(request.replacementLength, isNotNull);
return result.isEmpty;
}
@@ -2137,6 +2136,35 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
+ test_keyword() {
+ addSource('/testB.dart', '''
+ lib B;
+ int newT1;
+ int T1;
+ nowIsIt() { }
+ class X {factory X.c(); factory X._d(); z() {}}''');
+ addTestSource('''
+ import "/testB.dart";
+ String newer() {}
+ var m;
+ main() {new^ X.c();}''');
+ computeFast();
+ return computeFull((bool result) {
+ expect(request.replacementOffset, completionOffset - 3);
+ expect(request.replacementLength, 3);
+ assertNotSuggested('c');
+ assertNotSuggested('_d');
+ // Imported suggestion are filtered by 1st character
+ assertSuggestImportedFunction('nowIsIt', null);
+ assertNotSuggested('T1');
+ // TODO (danrubel) this really should be TopLevelVar not getter/setter
+ assertSuggestTopLevelVarGetterSetter('newT1', 'int');
+ assertNotSuggested('z');
+ assertSuggestLocalTopLevelVar('m', 'dynamic');
+ assertSuggestLocalFunction('newer', 'String');
+ });
+ }
+
test_Literal_string() {
// SimpleStringLiteral ExpressionStatement Block
addTestSource('class A {a() {"hel^lo"}}');

Powered by Google App Engine
This is Rietveld 408576698