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

Side by Side Diff: pkg/analysis_server/test/services/completion/local_computer_test.dart

Issue 645733002: improve suggestions in for statement (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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_server/test/services/completion/completion_test_util.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_server/src/services/completion/local_computer.dart'; 7 import 'package:analysis_server/src/services/completion/local_computer.dart';
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 9
10 import '../../reflective_tests.dart'; 10 import '../../reflective_tests.dart';
11 import 'completion_test_util.dart'; 11 import 'completion_test_util.dart';
12 12
13 main() { 13 main() {
14 groupSep = ' | '; 14 groupSep = ' | ';
15 runReflectiveTests(LocalComputerTest); 15 runReflectiveTests(LocalComputerTest);
16 } 16 }
17 17
18 @ReflectiveTestCase() 18 @ReflectiveTestCase()
19 class LocalComputerTest extends AbstractSelectorSuggestionTest { 19 class LocalComputerTest extends AbstractSelectorSuggestionTest {
20 20
21 @override 21 @override
22 void setUp() { 22 void setUp() {
23 super.setUp(); 23 super.setUp();
24 computer = new LocalComputer(); 24 computer = new LocalComputer();
25 } 25 }
26 26
27 test_ForEachStatement_body_typed() {
28 // Block ForEachStatement
29 addTestSource('main(args) {for (int foo in bar) {^}}');
30 expect(computeFast(), isTrue);
31 assertSuggestLocalVariable('foo', 'int');
32 }
33
34 test_ForEachStatement_body_untyped() {
35 // Block ForEachStatement
36 addTestSource('main(args) {for (foo in bar) {^}}');
37 expect(computeFast(), isTrue);
38 assertSuggestLocalVariable('foo', null);
39 }
40
41 test_ForStatement_body() {
42 // Block ForStatement
43 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}');
44 expect(computeFast(), isTrue);
45 assertSuggestLocalVariable('i', 'int');
46 }
47
48 test_ForStatement_condition() {
49 // SimpleIdentifier ForStatement
50 addTestSource('main() {for (int index = 0; i^)}');
51 expect(computeFast(), isTrue);
52 assertSuggestLocalVariable('index', 'int');
53 }
54
55 test_ForStatement_updaters() {
56 // SimpleIdentifier ForStatement
57 addTestSource('main() {for (int index = 0; index < 10; i^)}');
58 expect(computeFast(), isTrue);
59 assertSuggestLocalVariable('index', 'int');
60 }
61
62 test_ForStatement_updaters_prefix_expression() {
63 // SimpleIdentifier PrefixExpression ForStatement
64 addTestSource('main() {for (int index = 0; index < 10; ++i^)}');
65 expect(computeFast(), isTrue);
66 assertSuggestLocalVariable('index', 'int');
67 }
68
69 test_FunctionExpression_body_function() { 27 test_FunctionExpression_body_function() {
70 // Block BlockFunctionBody FunctionExpression 28 // Block BlockFunctionBody FunctionExpression
71 addTestSource('String foo(List args) {x.then((R b) {^});}'); 29 addTestSource('String foo(List args) {x.then((R b) {^});}');
72 expect(computeFast(), isTrue); 30 expect(computeFast(), isTrue);
73 var f = assertSuggestFunction('foo', 'String', false); 31 var f = assertSuggestFunction('foo', 'String', false);
74 expect(f.element.isPrivate, isFalse); 32 expect(f.element.isPrivate, isFalse);
75 assertSuggestParameter('args', 'List'); 33 assertSuggestParameter('args', 'List');
76 assertSuggestParameter('b', 'R'); 34 assertSuggestParameter('b', 'R');
77 } 35 }
78 36
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 91
134 test_MethodDeclaration_parameters_positional() { 92 test_MethodDeclaration_parameters_positional() {
135 // Block BlockFunctionBody MethodDeclaration 93 // Block BlockFunctionBody MethodDeclaration
136 addTestSource('class A {Z a(X x, [int y=1]) {^}}'); 94 addTestSource('class A {Z a(X x, [int y=1]) {^}}');
137 expect(computeFast(), isTrue); 95 expect(computeFast(), isTrue);
138 assertSuggestMethod('a', 'A', 'Z'); 96 assertSuggestMethod('a', 'A', 'Z');
139 assertSuggestParameter('x', 'X'); 97 assertSuggestParameter('x', 'X');
140 assertSuggestParameter('y', 'int'); 98 assertSuggestParameter('y', 'int');
141 } 99 }
142 } 100 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/completion/completion_test_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698