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

Side by Side Diff: pkg/analysis_server/test/services/completion/combinator_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, 1 month 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.combinator; 5 library test.services.completion.dart.combinator;
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/combinator_computer.dart '; 8 import 'package:analysis_server/src/services/completion/combinator_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(CombinatorComputerTest); 16 runReflectiveTests(CombinatorComputerTest);
17 } 17 }
18 18
19 @ReflectiveTestCase() 19 @ReflectiveTestCase()
20 class CombinatorComputerTest extends AbstractCompletionTest { 20 class CombinatorComputerTest extends AbstractCompletionTest {
21 21
22 @override 22 @override
23 void setUp() { 23 void setUpComputer() {
24 super.setUp();
25 computer = new CombinatorComputer(); 24 computer = new CombinatorComputer();
26 } 25 }
27 26
28 test_Block_inherited_local() { 27 test_Block_inherited_local() {
29 // Block BlockFunctionBody MethodDeclaration ClassDeclaration 28 // Block BlockFunctionBody MethodDeclaration ClassDeclaration
30 addTestSource(''' 29 addTestSource('''
31 class F { var f1; f2() { } } 30 class F { var f1; f2() { } }
32 class E extends F { var e1; e2() { } } 31 class E extends F { var e1; e2() { } }
33 class I { int i1; i2() { } } 32 class I { int i1; i2() { } }
34 class M { var m1; int m2() { } } 33 class M { var m1; int m2() { } }
35 class A extends E implements I with M {a() {^}}'''); 34 class A extends E implements I with M {a() {^}}''');
36 computeFast(); 35 computeFast();
37 return computeFull(true).then((_) { 36 return computeFull((bool result) {
38 assertNoSuggestions(); 37 assertNoSuggestions();
39 }); 38 });
40 } 39 }
41 40
42 test_Combinator_hide() { 41 test_Combinator_hide() {
43 // SimpleIdentifier HideCombinator ImportDirective 42 // SimpleIdentifier HideCombinator ImportDirective
44 addSource('/testAB.dart', ''' 43 addSource('/testAB.dart', '''
45 library libAB; 44 library libAB;
46 part '/partAB.dart'; 45 part '/partAB.dart';
47 class A { } 46 class A { }
48 class B { }'''); 47 class B { }''');
49 addSource('/partAB.dart', ''' 48 addSource('/partAB.dart', '''
50 part of libAB; 49 part of libAB;
51 var T1; 50 var T1;
52 PB F1() => new PB(); 51 PB F1() => new PB();
53 class PB { }'''); 52 class PB { }''');
54 addSource('/testCD.dart', ''' 53 addSource('/testCD.dart', '''
55 class C { } 54 class C { }
56 class D { }'''); 55 class D { }''');
57 addTestSource(''' 56 addTestSource('''
58 import "/testAB.dart" hide ^; 57 import "/testAB.dart" hide ^;
59 import "/testCD.dart"; 58 import "/testCD.dart";
60 class X {}'''); 59 class X {}''');
61 computeFast(); 60 computeFast();
62 return computeFull(true).then((_) { 61 return computeFull((bool result) {
63 assertSuggestClass( 62 assertSuggestClass(
64 'A', 63 'A',
65 CompletionRelevance.DEFAULT, 64 CompletionRelevance.DEFAULT,
66 CompletionSuggestionKind.IDENTIFIER); 65 CompletionSuggestionKind.IDENTIFIER);
67 assertSuggestClass( 66 assertSuggestClass(
68 'B', 67 'B',
69 CompletionRelevance.DEFAULT, 68 CompletionRelevance.DEFAULT,
70 CompletionSuggestionKind.IDENTIFIER); 69 CompletionSuggestionKind.IDENTIFIER);
71 assertSuggestClass( 70 assertSuggestClass(
72 'PB', 71 'PB',
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 class Clz = Object with Object; 104 class Clz = Object with Object;
106 class PB { }'''); 105 class PB { }''');
107 addSource('/testCD.dart', ''' 106 addSource('/testCD.dart', '''
108 class C { } 107 class C { }
109 class D { }'''); 108 class D { }''');
110 addTestSource(''' 109 addTestSource('''
111 import "/testAB.dart" show ^; 110 import "/testAB.dart" show ^;
112 import "/testCD.dart"; 111 import "/testCD.dart";
113 class X {}'''); 112 class X {}''');
114 computeFast(); 113 computeFast();
115 return computeFull(true).then((_) { 114 return computeFull((bool result) {
116 assertSuggestClass( 115 assertSuggestClass(
117 'A', 116 'A',
118 CompletionRelevance.DEFAULT, 117 CompletionRelevance.DEFAULT,
119 CompletionSuggestionKind.IDENTIFIER); 118 CompletionSuggestionKind.IDENTIFIER);
120 assertSuggestClass( 119 assertSuggestClass(
121 'B', 120 'B',
122 CompletionRelevance.DEFAULT, 121 CompletionRelevance.DEFAULT,
123 CompletionSuggestionKind.IDENTIFIER); 122 CompletionSuggestionKind.IDENTIFIER);
124 assertSuggestClass( 123 assertSuggestClass(
125 'PB', 124 'PB',
(...skipping 20 matching lines...) Expand all
146 false, 145 false,
147 CompletionRelevance.DEFAULT, 146 CompletionRelevance.DEFAULT,
148 CompletionSuggestionKind.IDENTIFIER); 147 CompletionSuggestionKind.IDENTIFIER);
149 assertNotSuggested('C'); 148 assertNotSuggested('C');
150 assertNotSuggested('D'); 149 assertNotSuggested('D');
151 assertNotSuggested('X'); 150 assertNotSuggested('X');
152 assertNotSuggested('Object'); 151 assertNotSuggested('Object');
153 }); 152 });
154 } 153 }
155 } 154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698