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

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

Issue 742163002: cache import suggestions (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 unified diff | Download patch | Annotate | Revision Log
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.arglist; 5 library test.services.completion.dart.arglist;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/completion/arglist_computer.dart'; 8 import 'package:analysis_server/src/services/completion/arglist_computer.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
11 import '../../reflective_tests.dart'; 11 import '../../reflective_tests.dart';
12 import 'completion_test_util.dart'; 12 import 'completion_test_util.dart';
13 13
14 main() { 14 main() {
15 groupSep = ' | '; 15 groupSep = ' | ';
16 runReflectiveTests(ArgListComputerTest); 16 runReflectiveTests(ArgListComputerTest);
17 } 17 }
18 18
19 @ReflectiveTestCase() 19 @ReflectiveTestCase()
20 class ArgListComputerTest extends AbstractCompletionTest { 20 class ArgListComputerTest extends AbstractCompletionTest {
21 21
22 @override 22 @override
23 void setUp() { 23 void setUpComputer() {
24 super.setUp();
25 computer = new ArgListComputer(); 24 computer = new ArgListComputer();
26 } 25 }
27 26
28 test_ArgumentList_imported_function_0() { 27 test_ArgumentList_imported_function_0() {
29 // ArgumentList MethodInvocation ExpressionStatement Block 28 // ArgumentList MethodInvocation ExpressionStatement Block
30 addSource('/libA.dart', ''' 29 addSource('/libA.dart', '''
31 library A; 30 library A;
32 bool hasLength(int expected) { } 31 bool hasLength(int expected) { }
33 expect() { } 32 expect() { }
34 void baz() { }'''); 33 void baz() { }''');
35 addTestSource(''' 34 addTestSource('''
36 import '/libA.dart' 35 import '/libA.dart'
37 class B { } 36 class B { }
38 String bar() => true; 37 String bar() => true;
39 void main() {expect(^)}'''); 38 void main() {expect(^)}''');
40 computeFast(); 39 computeFast();
41 return computeFull(true).then((_) { 40 return computeFull((bool result) {
42 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); 41 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
43 }); 42 });
44 } 43 }
45 44
46 // test_ArgumentList_imported_function_1() { 45 // test_ArgumentList_imported_function_1() {
47 // // ArgumentList MethodInvocation ExpressionStatement Block 46 // // ArgumentList MethodInvocation ExpressionStatement Block
48 // addSource('/libA.dart', ''' 47 // addSource('/libA.dart', '''
49 // library A; 48 // library A;
50 // bool hasLength(int expected) { } 49 // bool hasLength(int expected) { }
51 // expect(String arg) { } 50 // expect(String arg) { }
52 // void baz() { }'''); 51 // void baz() { }''');
53 // addTestSource(''' 52 // addTestSource('''
54 // import '/libA.dart' 53 // import '/libA.dart'
55 // class B { } 54 // class B { }
56 // String bar() => true; 55 // String bar() => true;
57 // void main() {expect(^)}'''); 56 // void main() {expect(^)}''');
58 // computeFast(); 57 // computeFast();
59 // return computeFull(true).then((_) { 58 // return computeFull((bool result) {
60 // assertSuggestArgumentList(['arg'], ['String']); 59 // assertSuggestArgumentList(['arg'], ['String']);
61 // }); 60 // });
62 // } 61 // }
63 62
64 test_ArgumentList_local_function_1() { 63 test_ArgumentList_local_function_1() {
65 // ArgumentList MethodInvocation ExpressionStatement Block 64 // ArgumentList MethodInvocation ExpressionStatement Block
66 addSource('/libA.dart', ''' 65 addSource('/libA.dart', '''
67 library A; 66 library A;
68 bool hasLength(int expected) { } 67 bool hasLength(int expected) { }
69 void baz() { }'''); 68 void baz() { }''');
70 addTestSource(''' 69 addTestSource('''
71 import '/libA.dart' 70 import '/libA.dart'
72 expect(arg) { } 71 expect(arg) { }
73 class B { } 72 class B { }
74 String bar() => true; 73 String bar() => true;
75 void main() {expect(^)}'''); 74 void main() {expect(^)}''');
76 computeFast(); 75 computeFast();
77 return computeFull(true).then((_) { 76 return computeFull((bool result) {
78 assertSuggestArgumentList(['arg'], ['dynamic']); 77 assertSuggestArgumentList(['arg'], ['dynamic']);
79 }); 78 });
80 } 79 }
81 80
82 test_ArgumentList_local_method_0() { 81 test_ArgumentList_local_method_0() {
83 // ArgumentList MethodInvocation ExpressionStatement Block 82 // ArgumentList MethodInvocation ExpressionStatement Block
84 addSource('/libA.dart', ''' 83 addSource('/libA.dart', '''
85 library A; 84 library A;
86 bool hasLength(int expected) { } 85 bool hasLength(int expected) { }
87 void baz() { }'''); 86 void baz() { }''');
88 addTestSource(''' 87 addTestSource('''
89 import '/libA.dart' 88 import '/libA.dart'
90 class B { 89 class B {
91 expect() { } 90 expect() { }
92 void foo() {expect(^)}} 91 void foo() {expect(^)}}
93 String bar() => true;'''); 92 String bar() => true;''');
94 computeFast(); 93 computeFast();
95 return computeFull(true).then((_) { 94 return computeFull((bool result) {
96 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); 95 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST);
97 }); 96 });
98 } 97 }
99 98
100 test_ArgumentList_local_method_2() { 99 test_ArgumentList_local_method_2() {
101 // ArgumentList MethodInvocation ExpressionStatement Block 100 // ArgumentList MethodInvocation ExpressionStatement Block
102 addSource('/libA.dart', ''' 101 addSource('/libA.dart', '''
103 library A; 102 library A;
104 bool hasLength(int expected) { } 103 bool hasLength(int expected) { }
105 void baz() { }'''); 104 void baz() { }''');
106 addTestSource(''' 105 addTestSource('''
107 import '/libA.dart' 106 import '/libA.dart'
108 class B { 107 class B {
109 expect(arg, int blat) { } 108 expect(arg, int blat) { }
110 void foo() {expect(^)}} 109 void foo() {expect(^)}}
111 String bar() => true;'''); 110 String bar() => true;''');
112 computeFast(); 111 computeFast();
113 return computeFull(true).then((_) { 112 return computeFull((bool result) {
114 assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']); 113 assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']);
115 }); 114 });
116 } 115 }
117 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698