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

Side by Side Diff: pkg/analysis_services/test/completion/local_computer_test.dart

Issue 460333003: do not suggest types when editing a name in a variable declaration (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_services/test/completion/imported_type_computer_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.completion.dart.local; 5 library test.services.completion.dart.local;
6 6
7 import 'package:analysis_services/src/completion/local_computer.dart'; 7 import 'package:analysis_services/src/completion/local_computer.dart';
8 import 'package:analysis_testing/reflective_tests.dart'; 8 import 'package:analysis_testing/reflective_tests.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 assertSuggestClass('B'); 52 assertSuggestClass('B');
53 assertSuggestTopLevelVar('T'); 53 assertSuggestTopLevelVar('T');
54 } 54 }
55 55
56 test_compilationUnit_directives() { 56 test_compilationUnit_directives() {
57 addTestSource('import "boo.dart" as x; class A {^}'); 57 addTestSource('import "boo.dart" as x; class A {^}');
58 expect(computeFast(), isTrue); 58 expect(computeFast(), isTrue);
59 assertSuggestLibraryPrefix('x'); 59 assertSuggestLibraryPrefix('x');
60 } 60 }
61 61
62 test_field_name() {
63 addTestSource('class A {B ^}}');
64 expect(computeFast(), isTrue);
65 assertNotSuggested('A');
66 }
67
68 test_field_name2() {
69 addTestSource('class A {var ^}}');
70 expect(computeFast(), isTrue);
71 //TODO (danrubel) should not be suggested
72 // but var ^ in this test
73 // parses differently than B ^ in test above
74 assertSuggestClass('A');
75 }
76
62 test_for() { 77 test_for() {
63 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}'); 78 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}');
64 expect(computeFast(), isTrue); 79 expect(computeFast(), isTrue);
65 assertSuggestVariable('i'); 80 assertSuggestVariable('i');
66 } 81 }
67 82
68 test_forEach() { 83 test_forEach() {
69 addTestSource('main(args) {for (foo in bar) {^}}'); 84 addTestSource('main(args) {for (foo in bar) {^}}');
70 expect(computeFast(), isTrue); 85 expect(computeFast(), isTrue);
71 assertSuggestVariable('foo'); 86 assertSuggestVariable('foo');
72 } 87 }
73 88
74 test_function() { 89 test_function() {
75 addTestSource('main(args) {x.then((b) {^});}'); 90 addTestSource('main(args) {x.then((b) {^});}');
76 expect(computeFast(), isTrue); 91 expect(computeFast(), isTrue);
77 assertSuggestFunction('main'); 92 assertSuggestFunction('main');
78 assertSuggestParameter('args'); 93 assertSuggestParameter('args');
79 assertSuggestParameter('b'); 94 assertSuggestParameter('b');
80 } 95 }
81 96
97 test_local_name() {
98 addTestSource('class A {a() {var f; A ^}}');
99 expect(computeFast(), isTrue);
100 //TODO (danrubel) should not be suggested
101 // but A ^ in this test
102 // parses differently than var ^ in test below
103 assertSuggestClass('A');
104 assertSuggestMethodName('a');
105 assertSuggestVariable('f');
106 }
107
108 test_local_name2() {
109 addTestSource('class A {a() {var f; var ^}}');
110 expect(computeFast(), isTrue);
111 assertNotSuggested('A');
112 assertNotSuggested('a');
113 assertNotSuggested('f');
114 }
115
82 test_members() { 116 test_members() {
83 addTestSource('class A {var f; a() {^} var g;}'); 117 addTestSource('class A {var f; a() {^} var g;}');
84 expect(computeFast(), isTrue); 118 expect(computeFast(), isTrue);
85 assertSuggestMethodName('a'); 119 assertSuggestMethodName('a');
86 assertSuggestField('f'); 120 assertSuggestField('f');
87 assertSuggestField('g'); 121 assertSuggestField('g');
88 } 122 }
89 123
90 test_methodParam_named() { 124 test_methodParam_named() {
91 addTestSource('class A {a(x, {y: boo}) {^}}'); 125 addTestSource('class A {a(x, {y: boo}) {^}}');
92 expect(computeFast(), isTrue); 126 expect(computeFast(), isTrue);
93 assertSuggestMethodName('a'); 127 assertSuggestMethodName('a');
94 assertSuggestParameter('x'); 128 assertSuggestParameter('x');
95 assertSuggestParameter('y'); 129 assertSuggestParameter('y');
96 } 130 }
97 131
98 test_methodParam_positional() { 132 test_methodParam_positional() {
99 addTestSource('class A {a(x, [y=1]) {^}}'); 133 addTestSource('class A {a(x, [y=1]) {^}}');
100 expect(computeFast(), isTrue); 134 expect(computeFast(), isTrue);
101 assertSuggestMethodName('a'); 135 assertSuggestMethodName('a');
102 assertSuggestParameter('x'); 136 assertSuggestParameter('x');
103 assertSuggestParameter('y'); 137 assertSuggestParameter('y');
104 } 138 }
105 139
140 test_topLevelVar_name() {
141 addTestSource('class A {} B ^');
142 expect(computeFast(), isTrue);
143 assertNotSuggested('A');
144 }
145
146 test_topLevelVar_name2() {
147 addTestSource('class A {} var ^');
148 expect(computeFast(), isTrue);
149 // TODO (danrubel) should not be suggested
150 // but var ^ in this test
151 // parses differently than B ^ in test above
152 assertSuggestClass('A');
153 }
154
106 test_variableDeclaration() { 155 test_variableDeclaration() {
107 addTestSource('main() {int a = 1, b = 2 + ^;}'); 156 addTestSource('main() {int a = 1, b = 2 + ^;}');
108 expect(computeFast(), isTrue); 157 expect(computeFast(), isTrue);
109 assertSuggestVariable('a'); 158 assertSuggestVariable('a');
110 assertNotSuggested('b'); 159 assertNotSuggested('b');
111 } 160 }
112 } 161 }
113
OLDNEW
« no previous file with comments | « pkg/analysis_services/test/completion/imported_type_computer_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698