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

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

Issue 803913003: fix named constructor completion (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « pkg/analysis_server/test/mock_sdk.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10d6020e6290ce88b1bb491fba0060ed42aff17a..326899cf1c3ac2382db1dca8fbbab1207d040ea1 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -1026,8 +1026,9 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
assertSuggestImportedClass('C');
// hidden element suggested as low relevance
// but imported results are partially filtered
- //assertSuggestImportedClass('D', CompletionRelevance.LOW);
- //assertSuggestImportedFunction('D1', null, true, CompletionRelevance.LOW);
+ //assertSuggestImportedClass('D', CompletionRelevance.LOW)
Paul Berry 2014/12/15 16:27:30 Was the semicolon removed by mistake?
danrubel 2014/12/15 17:18:30 Yes. Will add back in following CL
+ //assertSuggestImportedFunction(
+ // 'D1', null, true, CompletionRelevance.LOW);
assertSuggestLocalFunction('D2', 'Z');
assertSuggestImportedClass('EE');
// hidden element suggested as low relevance
@@ -1422,6 +1423,45 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
+ test_ConstructorName_importedFactory() {
+ // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // InstanceCreationExpression
+ addSource('/testB.dart', '''
+ lib B;
+ int T1;
+ F1() { }
+ class X {factory X.c(); factory X._d(); z() {}}''');
+ addTestSource('''
+ import "/testB.dart";
+ var m;
+ main() {new X.^}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestNamedConstructor('c', 'X');
+ assertNotSuggested('F1');
+ assertNotSuggested('T1');
+ assertNotSuggested('_d');
+ assertNotSuggested('z');
+ assertNotSuggested('m');
+ });
+ }
+
+ test_ConstructorName_importedFactory2() {
+ // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // InstanceCreationExpression
+ addTestSource('''
+ main() {new String.fr^omCharCodes([]);}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestNamedConstructor('fromCharCodes', 'String');
+ assertNotSuggested('isEmpty');
+ assertNotSuggested('isNotEmpty');
+ assertNotSuggested('length');
+ assertNotSuggested('Object');
+ assertNotSuggested('String');
+ });
+ }
+
test_ConstructorName_localClass() {
// SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
// InstanceCreationExpression
@@ -1441,6 +1481,25 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
+ test_ConstructorName_localFactory() {
+ // SimpleIdentifier PrefixedIdentifier TypeName ConstructorName
+ // InstanceCreationExpression
+ addTestSource('''
+ int T1;
+ F1() { }
+ class X {factory X.c(); factory X._d(); z() {}}
+ main() {new X.^}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestNamedConstructor('c', 'X');
+ assertSuggestNamedConstructor('_d', 'X');
+ assertNotSuggested('F1');
+ assertNotSuggested('T1');
+ assertNotSuggested('z');
+ assertNotSuggested('m');
+ });
+ }
+
test_ExpressionStatement_identifier() {
// SimpleIdentifier ExpressionStatement Block
addSource('/testA.dart', '''
« no previous file with comments | « pkg/analysis_server/test/mock_sdk.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698