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

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

Issue 802233002: refine when suggestions are limited to types (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
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..911f66887a763554bcd35d2d96d6282f0e1b69f8 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -930,13 +930,86 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
test_AssignmentExpression_type() {
// SimpleIdentifier TypeName VariableDeclarationList
// VariableDeclarationStatement Block
- addTestSource('class A {} main() {int a; int^ b = 1;}');
+ addTestSource('''
+ class A {} main() {
+ int a;
+ ^ b = 1;}''');
computeFast();
return computeFull((bool result) {
assertSuggestLocalClass('A');
assertSuggestImportedClass('int');
- assertNotSuggested('a');
- assertNotSuggested('main');
+ // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
+ // the user may be either (1) entering a type for the assignment
+ // or (2) starting a new statement.
+ // Consider suggesting only types
+ // if only spaces separates the 1st and 2nd identifiers.
+ //assertNotSuggested('a');
+ //assertNotSuggested('main');
+ //assertNotSuggested('identical');
+ });
+ }
+
+ test_AssignmentExpression_type_partial() {
+ // SimpleIdentifier TypeName VariableDeclarationList
+ // VariableDeclarationStatement Block
+ addTestSource('''
+ class A {} main() {
+ int a;
+ int^ b = 1;}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestLocalClass('A');
+ assertSuggestImportedClass('int');
+ // TODO (danrubel) When entering 1st of 2 identifiers on assignment LHS
+ // the user may be either (1) entering a type for the assignment
+ // or (2) starting a new statement.
+ // Consider suggesting only types
+ // if only spaces separates the 1st and 2nd identifiers.
+ //assertNotSuggested('a');
+ //assertNotSuggested('main');
+ //assertNotSuggested('identical');
+ });
+ }
+
+ test_AssignmentExpression_type_newline() {
+ // SimpleIdentifier TypeName VariableDeclarationList
+ // VariableDeclarationStatement Block
+ addTestSource('''
+ class A {} main() {
+ int a;
+ ^
+ b = 1;}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestLocalClass('A');
+ assertSuggestImportedClass('int');
+ // Allow non-types preceding an identifier on LHS of assignment
+ // if newline follows first identifier
+ // because user is probably starting a new statement
+ assertSuggestLocalVariable('a', 'int');
+ assertSuggestLocalFunction('main', null);
+ assertSuggestImportedFunction('identical', 'bool');
+ });
+ }
+
+ test_AssignmentExpression_type_partial_newline() {
+ // SimpleIdentifier TypeName VariableDeclarationList
+ // VariableDeclarationStatement Block
+ addTestSource('''
+ class A {} main() {
+ int a;
+ i^
+ b = 1;}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestLocalClass('A');
+ assertSuggestImportedClass('int');
+ // Allow non-types preceding an identifier on LHS of assignment
+ // if newline follows first identifier
+ // because user is probably starting a new statement
+ assertSuggestLocalVariable('a', 'int');
+ assertSuggestLocalFunction('main', null);
+ assertSuggestImportedFunction('identical', 'bool');
});
}

Powered by Google App Engine
This is Rietveld 408576698