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

Unified Diff: pkg/analysis_server/test/domain_completion_test.dart

Issue 815683002: support part file completions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years 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/domain_completion_test.dart
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 34246b7c6f16f0c817ad47dfb51be3037396c573..365ae51ded44ae7159cf455f7fc6deb449c591f3 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -363,6 +363,46 @@ class CompletionTest extends AbstractAnalysisTest {
});
}
+ test_partFile() {
+ addFile('/project/bin/testA.dart', '''
+ library libA;
+ part "$testFile";
+ import 'dart:html';
+ class A { }
+ ''');
+ addTestFile('''
+ part of libA;
+ main() {^}''');
+ return getSuggestions().then((_) {
+ expect(replacementOffset, equals(completionOffset));
+ expect(replacementLength, equals(0));
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'A');
+ assertNoResult('test');
+ });
+ }
+
+ test_partFile2() {
+ addFile('/testA.dart', '''
+ part of libA;
+ class A { }''');
+ addTestFile('''
+ library libA;
+ part "/testA.dart";
+ import 'dart:html';
+ main() {^}
+ ''');
+ return getSuggestions().then((_) {
+ expect(replacementOffset, equals(completionOffset));
+ expect(replacementLength, equals(0));
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'Object');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'HtmlElement');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'A');
+ assertNoResult('test');
+ });
+ }
+
test_imports_prefixed() {
addTestFile('''
import 'dart:html' as foo;
@@ -387,6 +427,15 @@ class CompletionTest extends AbstractAnalysisTest {
});
}
+ test_invocation_withTrailingStmt() {
+ addTestFile('class A {b() {}} main() {A a; a.^ int x = 7;}');
+ return getSuggestions().then((_) {
+ expect(replacementOffset, equals(completionOffset));
+ expect(replacementLength, equals(0));
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'b');
+ });
+ }
+
test_keyword() {
addTestFile('library A; cl^');
return getSuggestions().then((_) {

Powered by Google App Engine
This is Rietveld 408576698