OLD | NEW |
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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library engine.search_engine_test; | 8 library services.src.search.search_engine_test; |
9 | 9 |
10 | 10 import 'dart:async'; |
11 main() { | 11 |
12 } | 12 import 'package:analysis_services/index/index.dart'; |
13 | 13 import 'package:analysis_services/index/local_memory_index.dart'; |
14 | 14 import 'package:analysis_services/search/search_engine.dart'; |
15 //class AndSearchPatternTest extends EngineTestCase { | 15 import 'package:analysis_services/src/search/search_engine.dart'; |
16 // Element _element = mock(Element); | 16 import 'package:analysis_testing/mocks.dart'; |
17 // | 17 import 'package:analysis_testing/reflective_tests.dart'; |
18 // SearchPattern _patternA = mock(SearchPattern); | 18 import 'package:analyzer/src/generated/element.dart'; |
19 // | 19 import 'package:analyzer/src/generated/source.dart'; |
20 // SearchPattern _patternB = mock(SearchPattern); | 20 import 'package:typed_mock/typed_mock.dart'; |
21 // | 21 import 'package:unittest/unittest.dart'; |
22 // AndSearchPattern _pattern = new AndSearchPattern([_patternA, _patternB]); | 22 |
23 // | 23 import '../index/abstract_single_unit.dart'; |
24 // void test_allExact() { | 24 |
25 // when(_patternA.matches(_element)).thenReturn(MatchQuality.EXACT); | 25 |
26 // when(_patternB.matches(_element)).thenReturn(MatchQuality.EXACT); | 26 main() { |
27 // // validate | 27 groupSep = ' | '; |
28 // JUnitTestCase.assertSame(MatchQuality.EXACT, _pattern.matches(_element)); | 28 group('SearchEngineImplTest', () { |
| 29 runReflectiveTests(SearchEngineImplTest); |
| 30 }); |
| 31 } |
| 32 |
| 33 class ExpectedMatch { |
| 34 final Element element; |
| 35 final MatchKind kind; |
| 36 SourceRange range; |
| 37 final bool isResolved; |
| 38 final bool isQualified; |
| 39 |
| 40 ExpectedMatch(this.element, this.kind, int offset, int length, |
| 41 {this.isResolved: true, this.isQualified: false}) { |
| 42 this.range = new SourceRange(offset, length); |
| 43 } |
| 44 |
| 45 bool operator ==(SearchMatch match) { |
| 46 return match.element == this.element && |
| 47 match.kind == this.kind && |
| 48 match.isResolved == this.isResolved && |
| 49 match.isQualified == this.isQualified && |
| 50 match.sourceRange == this.range; |
| 51 } |
| 52 |
| 53 @override |
| 54 String toString() { |
| 55 StringBuffer buffer = new StringBuffer(); |
| 56 buffer.write("ExpectedMatch(kind="); |
| 57 buffer.write(kind); |
| 58 buffer.write(", element="); |
| 59 buffer.write(element != null ? element.displayName : 'null'); |
| 60 buffer.write(", range="); |
| 61 buffer.write(range); |
| 62 buffer.write(", isResolved="); |
| 63 buffer.write(isResolved); |
| 64 buffer.write(", isQualified="); |
| 65 buffer.write(isQualified); |
| 66 buffer.write(")"); |
| 67 return buffer.toString(); |
| 68 } |
| 69 } |
| 70 |
| 71 |
| 72 class MockAngularComponentElement extends TypedMock implements |
| 73 AngularComponentElement { |
| 74 final kind = ElementKind.ANGULAR_COMPONENT; |
| 75 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 76 } |
| 77 |
| 78 |
| 79 class MockAngularControllerElement extends TypedMock implements |
| 80 AngularControllerElement { |
| 81 final kind = ElementKind.ANGULAR_CONTROLLER; |
| 82 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 83 } |
| 84 |
| 85 |
| 86 class MockAngularFormatterElement extends TypedMock implements |
| 87 AngularFormatterElement { |
| 88 final kind = ElementKind.ANGULAR_FORMATTER; |
| 89 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 90 } |
| 91 |
| 92 |
| 93 class MockIndex extends TypedMock implements Index { |
| 94 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 95 } |
| 96 |
| 97 |
| 98 @ReflectiveTestCase() |
| 99 class SearchEngineImplTest extends AbstractSingleUnitTest { |
| 100 Index index; |
| 101 SearchEngineImpl searchEngine; |
| 102 |
| 103 // void mockLocation(Element element, Relationship relationship, |
| 104 // Location location) { |
| 105 // mockLocations(element, relationship, [location]); |
29 // } | 106 // } |
30 // | 107 // |
31 // void test_ExactName() { | 108 // void mockLocations(Element element, Relationship relationship, |
32 // when(_patternA.matches(_element)).thenReturn(MatchQuality.EXACT); | 109 // List<Location> locations) { |
33 // when(_patternB.matches(_element)).thenReturn(MatchQuality.NAME); | 110 // index.getRelationships(element, relationship); |
34 // // validate | 111 // when(null).thenReturn(new Future.value(locations)); |
35 // JUnitTestCase.assertSame(MatchQuality.EXACT, _pattern.matches(_element)); | |
36 // } | 112 // } |
37 // | 113 |
38 // void test_NameExact() { | 114 void setUp() { |
39 // when(_patternA.matches(_element)).thenReturn(MatchQuality.NAME); | 115 super.setUp(); |
40 // when(_patternB.matches(_element)).thenReturn(MatchQuality.EXACT); | 116 index = createLocalMemoryIndex(); |
41 // // validate | 117 searchEngine = new SearchEngineImpl(index); |
42 // JUnitTestCase.assertSame(MatchQuality.EXACT, _pattern.matches(_element)); | 118 } |
43 // } | 119 |
44 // | 120 Future test_searchMemberDeclarations() { |
45 // void test_oneNull() { | 121 _indexTestUnit(''' |
46 // when(_patternA.matches(_element)).thenReturn(MatchQuality.EXACT); | 122 class A { |
47 // when(_patternB.matches(_element)).thenReturn(null); | 123 test() {} |
48 // // validate | 124 } |
49 // JUnitTestCase.assertSame(null, _pattern.matches(_element)); | 125 class B { |
50 // } | 126 int test = 42; |
51 // | 127 } |
52 // static dartSuite() { | 128 '''); |
53 // _ut.group('AndSearchPatternTest', () { | 129 NameElement element = new NameElement('test'); |
54 // _ut.test('test_ExactName', () { | 130 ClassElement elementA = findElement('A'); |
55 // final __test = new AndSearchPatternTest(); | 131 ClassElement elementB = findElement('B'); |
56 // runJUnitTest(__test, __test.test_ExactName); | 132 var expected = [ |
57 // }); | 133 _expectId(elementA.methods[0], MatchKind.NAME_DECLARATION, 'test() {}'), |
58 // _ut.test('test_NameExact', () { | 134 _expectId(elementB.fields[0], MatchKind.NAME_DECLARATION, 'test = 42;')]
; |
59 // final __test = new AndSearchPatternTest(); | 135 return searchEngine.searchMemberDeclarations('test').then((matches) { |
60 // runJUnitTest(__test, __test.test_NameExact); | 136 _assertMatches(matches, expected); |
61 // }); | 137 }); |
62 // _ut.test('test_allExact', () { | 138 } |
63 // final __test = new AndSearchPatternTest(); | 139 |
64 // runJUnitTest(__test, __test.test_allExact); | 140 Future test_searchReferences_AngularComponentElement() { |
65 // }); | 141 // use mocks |
66 // _ut.test('test_oneNull', () { | 142 index = new MockIndex(); |
67 // final __test = new AndSearchPatternTest(); | 143 searchEngine = new SearchEngineImpl(index); |
68 // runJUnitTest(__test, __test.test_oneNull); | 144 Element elementA = new MockElement('A'); |
69 // }); | 145 Element elementB = new MockElement('B'); |
70 // }); | 146 // fill mocks |
71 // } | 147 AngularComponentElement element = new MockAngularComponentElement(); |
72 //} | 148 void mockLocation(Element element, Relationship relationship, |
73 // | 149 Location location) { |
74 //class CamelCaseSearchPatternTest extends EngineTestCase { | 150 index.getRelationships(element, relationship); |
75 // void test_matchExact_samePartCount() { | 151 when(null).thenReturn(new Future.value([location])); |
76 // Element element = mock(Element); | 152 } |
77 // when(element.displayName).thenReturn("HashMap"); | 153 mockLocation( |
78 // // | 154 element, |
79 // CamelCaseSearchPattern pattern = new CamelCaseSearchPattern("HM", true); | 155 IndexConstants.ANGULAR_REFERENCE, |
80 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(element)); | 156 new Location(elementA, 1, 10)); |
81 // } | 157 mockLocation( |
82 // | 158 element, |
83 // void test_matchExact_withLowerCase() { | 159 IndexConstants.ANGULAR_CLOSING_TAG_REFERENCE, |
84 // Element element = mock(Element); | 160 new Location(elementB, 2, 20)); |
85 // when(element.displayName).thenReturn("HashMap"); | 161 var expected = [ |
86 // // | 162 new ExpectedMatch(elementA, MatchKind.ANGULAR_REFERENCE, 1, 10), |
87 // CamelCaseSearchPattern pattern = new CamelCaseSearchPattern("HaMa", true); | 163 new ExpectedMatch(elementB, MatchKind.ANGULAR_CLOSING_TAG_REFERENCE, 2,
20)]; |
88 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(element)); | 164 return _verifyReferences(element, expected); |
89 // } | 165 } |
90 // | 166 |
91 // void test_matchNot_nullName() { | 167 Future test_searchReferences_ClassElement() { |
92 // Element element = mock(Element); | 168 _indexTestUnit(''' |
93 // when(element.displayName).thenReturn(null); | 169 class A {} |
94 // // | 170 main(A p) { |
95 // CamelCaseSearchPattern pattern = new CamelCaseSearchPattern("HM", true); | 171 A v; |
96 // JUnitTestCase.assertSame(null, pattern.matches(element)); | 172 } |
97 // } | 173 '''); |
98 // | 174 ClassElement element = findElement('A'); |
99 // void test_matchNot_samePartCount() { | 175 Element pElement = findElement('p'); |
100 // Element element = mock(Element); | 176 Element vElement = findElement('v'); |
101 // when(element.displayName).thenReturn("LinkedHashMap"); | 177 var expected = [ |
102 // // | 178 _expectId(pElement, MatchKind.TYPE_REFERENCE, 'A p'), |
103 // CamelCaseSearchPattern pattern = new CamelCaseSearchPattern("LH", true); | 179 _expectId(vElement, MatchKind.TYPE_REFERENCE, 'A v')]; |
104 // JUnitTestCase.assertSame(null, pattern.matches(element)); | 180 return _verifyReferences(element, expected); |
105 // } | 181 } |
106 // | 182 |
107 // void test_matchNot_withLowerCase() { | 183 Future test_searchReferences_CompilationUnitElement() { |
108 // Element element = mock(Element); | 184 addSource('/my_part.dart', ''' |
109 // when(element.displayName).thenReturn("HashMap"); | 185 part of lib; |
110 // // | 186 '''); |
111 // CamelCaseSearchPattern pattern = new CamelCaseSearchPattern("HaMu", true); | 187 _indexTestUnit(''' |
112 // JUnitTestCase.assertSame(null, pattern.matches(element)); | 188 library lib; |
113 // } | 189 part 'my_part.dart'; |
114 // | 190 '''); |
115 // static dartSuite() { | 191 CompilationUnitElement element = testLibraryElement.parts[0]; |
116 // _ut.group('CamelCaseSearchPatternTest', () { | 192 var expected = [ |
117 // _ut.test('test_matchExact_samePartCount', () { | 193 _expectId( |
118 // final __test = new CamelCaseSearchPatternTest(); | 194 testUnitElement, |
119 // runJUnitTest(__test, __test.test_matchExact_samePartCount); | 195 MatchKind.UNIT_REFERENCE, |
120 // }); | 196 "'my_part.dart'", |
121 // _ut.test('test_matchExact_withLowerCase', () { | 197 length: "'my_part.dart'".length)]; |
122 // final __test = new CamelCaseSearchPatternTest(); | 198 return _verifyReferences(element, expected); |
123 // runJUnitTest(__test, __test.test_matchExact_withLowerCase); | 199 } |
124 // }); | 200 |
125 // _ut.test('test_matchNot_nullName', () { | 201 Future test_searchReferences_ConstructorElement() { |
126 // final __test = new CamelCaseSearchPatternTest(); | 202 _indexTestUnit(''' |
127 // runJUnitTest(__test, __test.test_matchNot_nullName); | 203 class A { |
128 // }); | 204 A.named() {} |
129 // _ut.test('test_matchNot_samePartCount', () { | 205 } |
130 // final __test = new CamelCaseSearchPatternTest(); | 206 main() { |
131 // runJUnitTest(__test, __test.test_matchNot_samePartCount); | 207 new A.named(); |
132 // }); | 208 } |
133 // _ut.test('test_matchNot_withLowerCase', () { | 209 '''); |
134 // final __test = new CamelCaseSearchPatternTest(); | 210 ConstructorElement element = findElement('named'); |
135 // runJUnitTest(__test, __test.test_matchNot_withLowerCase); | 211 ClassElement elementA = findElement('A'); |
136 // }); | 212 Element mainElement = findElement('main'); |
137 // }); | 213 var expected = [ |
138 // } | 214 _expectId( |
139 //} | 215 elementA, |
140 // | 216 MatchKind.CONSTRUCTOR_DECLARATION, |
141 //class CountingSearchListenerTest extends EngineTestCase { | 217 '.named() {}', |
142 // void test_matchFound() { | 218 length: 6), |
143 // SearchListener listener = mock(SearchListener); | 219 _expectId( |
144 // SearchMatch match = mock(SearchMatch); | 220 mainElement, |
145 // SearchListener countingListener = new CountingSearchListener(2, listener); | 221 MatchKind.CONSTRUCTOR_REFERENCE, |
146 // // "match" should be passed to "listener" | 222 '.named();', |
147 // countingListener.matchFound(match); | 223 length: 6)]; |
148 // verify(listener).matchFound(match); | 224 return _verifyReferences(element, expected); |
149 // verifyNoMoreInteractions(listener); | 225 } |
150 // } | 226 |
151 // | 227 Future test_searchReferences_Element_unknown() { |
152 // void test_searchComplete() { | 228 return _verifyReferences(UniverseElement.INSTANCE, []); |
153 // SearchListener listener = mock(SearchListener); | 229 } |
154 // SearchListener countingListener = new CountingSearchListener(2, listener); | 230 |
155 // // complete 2 -> 1 | 231 Future test_searchReferences_FieldElement() { |
156 // countingListener.searchComplete(); | 232 _indexTestUnit(''' |
157 // verifyZeroInteractions(listener); | 233 class A { |
158 // // complete 2 -> 0 | 234 var field; |
159 // countingListener.searchComplete(); | 235 A({this.field}); |
160 // verify(listener).searchComplete(); | 236 main() { |
161 // } | 237 new A(field: 1); |
162 // | 238 // getter |
163 // void test_searchComplete_zero() { | 239 print(field); // ref-nq |
164 // SearchListener listener = mock(SearchListener); | 240 print(this.field); // ref-q |
165 // new CountingSearchListener(0, listener); | 241 field(); // inv-nq |
166 // // complete at 0 | 242 this.field(); // inv-q |
167 // verify(listener).searchComplete(); | 243 // setter |
168 // } | 244 field = 2; // ref-nq; |
169 // | 245 this.field = 3; // ref-q; |
170 // static dartSuite() { | 246 } |
171 // _ut.group('CountingSearchListenerTest', () { | 247 } |
172 // _ut.test('test_matchFound', () { | 248 '''); |
173 // final __test = new CountingSearchListenerTest(); | 249 FieldElement element = findElement('field'); |
174 // runJUnitTest(__test, __test.test_matchFound); | 250 Element main = findElement('main'); |
175 // }); | 251 Element fieldParameter = findElement('field', ElementKind.PARAMETER); |
176 // _ut.test('test_searchComplete', () { | 252 var expected = [ |
177 // final __test = new CountingSearchListenerTest(); | 253 _expectIdQ(fieldParameter, MatchKind.FIELD_REFERENCE, 'field}'), |
178 // runJUnitTest(__test, __test.test_searchComplete); | 254 _expectIdQ(main, MatchKind.FIELD_REFERENCE, 'field: 1'), |
179 // }); | 255 _expectId(main, MatchKind.FIELD_READ, 'field); // ref-nq'), |
180 // _ut.test('test_searchComplete_zero', () { | 256 _expectIdQ(main, MatchKind.FIELD_READ, 'field); // ref-q'), |
181 // final __test = new CountingSearchListenerTest(); | 257 _expectId(main, MatchKind.FIELD_INVOCATION, 'field(); // inv-nq'), |
182 // runJUnitTest(__test, __test.test_searchComplete_zero); | 258 _expectIdQ(main, MatchKind.FIELD_INVOCATION, 'field(); // inv-q'), |
183 // }); | 259 _expectId(main, MatchKind.FIELD_WRITE, 'field = 2; // ref-nq'), |
184 // }); | 260 _expectIdQ(main, MatchKind.FIELD_WRITE, 'field = 3; // ref-q')]; |
185 // } | 261 return _verifyReferences(element, expected); |
186 //} | 262 } |
187 // | 263 |
188 //class ExactSearchPatternTest extends EngineTestCase { | 264 Future test_searchReferences_FunctionElement() { |
189 // Element _element = mock(Element); | 265 _indexTestUnit(''' |
190 // | 266 test() {} |
191 // void test_caseInsensitive_false() { | 267 main() { |
192 // SearchPattern pattern = new ExactSearchPattern("HashMa", false); | 268 test(); |
193 // when(_element.displayName).thenReturn("HashMap"); | 269 print(test); |
194 // // validate | 270 } |
195 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | 271 '''); |
196 // } | 272 FunctionElement element = findElement('test'); |
197 // | 273 Element mainElement = findElement('main'); |
198 // void test_caseInsensitive_true() { | 274 var expected = [ |
199 // SearchPattern pattern = new ExactSearchPattern("HashMap", false); | 275 _expectId(mainElement, MatchKind.FUNCTION_EXECUTION, 'test();'), |
200 // when(_element.displayName).thenReturn("HashMaP"); | 276 _expectId(mainElement, MatchKind.FUNCTION_REFERENCE, 'test);')]; |
201 // // validate | 277 return _verifyReferences(element, expected); |
202 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | 278 } |
203 // } | 279 |
204 // | 280 Future test_searchReferences_FunctionTypeAliasElement() { |
205 // void test_caseSensitive_false() { | 281 _indexTestUnit(''' |
206 // SearchPattern pattern = new ExactSearchPattern("HashMa", true); | 282 typedef Test(); |
207 // when(_element.displayName).thenReturn("HashMap"); | 283 main() { |
208 // // validate | 284 Test a; |
209 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | 285 Test b; |
210 // } | 286 } |
211 // | 287 '''); |
212 // void test_caseSensitive_true() { | 288 FunctionTypeAliasElement element = findElement('Test'); |
213 // SearchPattern pattern = new ExactSearchPattern("HashMap", true); | 289 Element aElement = findElement('a'); |
214 // when(_element.displayName).thenReturn("HashMap"); | 290 Element bElement = findElement('b'); |
215 // // validate | 291 var expected = [ |
216 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | 292 _expectId(aElement, MatchKind.FUNCTION_TYPE_REFERENCE, 'Test a;'), |
217 // } | 293 _expectId(bElement, MatchKind.FUNCTION_TYPE_REFERENCE, 'Test b;')]; |
218 // | 294 return _verifyReferences(element, expected); |
219 // void test_nullName() { | 295 } |
220 // SearchPattern pattern = new ExactSearchPattern("HashMap", true); | 296 |
221 // when(_element.displayName).thenReturn(null); | 297 Future test_searchReferences_ImportElement_noPrefix() { |
222 // // validate | 298 _indexTestUnit(''' |
223 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | 299 import 'dart:math'; |
224 // } | 300 main() { |
225 // | 301 print(E); |
226 // static dartSuite() { | 302 } |
227 // _ut.group('ExactSearchPatternTest', () { | 303 '''); |
228 // _ut.test('test_caseInsensitive_false', () { | 304 ImportElement element = testLibraryElement.imports[0]; |
229 // final __test = new ExactSearchPatternTest(); | 305 Element mainElement = findElement('main'); |
230 // runJUnitTest(__test, __test.test_caseInsensitive_false); | 306 var kind = MatchKind.IMPORT_REFERENCE; |
231 // }); | 307 var expected = [_expectId(mainElement, kind, 'E);', length: 0)]; |
232 // _ut.test('test_caseInsensitive_true', () { | 308 return _verifyReferences(element, expected); |
233 // final __test = new ExactSearchPatternTest(); | 309 } |
234 // runJUnitTest(__test, __test.test_caseInsensitive_true); | 310 |
235 // }); | 311 Future test_searchReferences_ImportElement_withPrefix() { |
236 // _ut.test('test_caseSensitive_false', () { | 312 _indexTestUnit(''' |
237 // final __test = new ExactSearchPatternTest(); | 313 import 'dart:math' as math; |
238 // runJUnitTest(__test, __test.test_caseSensitive_false); | 314 main() { |
239 // }); | 315 print(math.PI); |
240 // _ut.test('test_caseSensitive_true', () { | 316 } |
241 // final __test = new ExactSearchPatternTest(); | 317 '''); |
242 // runJUnitTest(__test, __test.test_caseSensitive_true); | 318 ImportElement element = testLibraryElement.imports[0]; |
243 // }); | 319 Element mainElement = findElement('main'); |
244 // _ut.test('test_nullName', () { | 320 var kind = MatchKind.IMPORT_REFERENCE; |
245 // final __test = new ExactSearchPatternTest(); | 321 var expected = [ |
246 // runJUnitTest(__test, __test.test_nullName); | 322 _expectId(mainElement, kind, 'math.PI);', length: 'math.'.length)]; |
247 // }); | 323 return _verifyReferences(element, expected); |
248 // }); | 324 } |
249 // } | 325 |
250 //} | 326 Future test_searchReferences_LibraryElement() { |
251 // | 327 var codeA = 'part of lib; // A'; |
252 //class FilterSearchListenerTest extends EngineTestCase { | 328 var codeB = 'part of lib; // B'; |
253 // SearchListener _listener = mock(SearchListener); | 329 var sourceA = addSource('/unitA.dart', codeA); |
254 // | 330 var sourceB = addSource('/unitB.dart', codeB); |
255 // SearchMatch _match = mock(SearchMatch); | 331 _indexTestUnit(''' |
256 // | 332 library lib; |
257 // SearchFilter _filter = mock(SearchFilter); | 333 part 'unitA.dart'; |
258 // | 334 part 'unitB.dart'; |
259 // SearchListener _filteredListener = new FilteredSearchListener(_filter, _list
ener); | 335 '''); |
260 // | 336 LibraryElement element = testLibraryElement; |
261 // void test_matchFound_filterFalse() { | 337 CompilationUnitElement elementA = element.parts[0]; |
262 // when(_filter.passes(_match)).thenReturn(false); | 338 CompilationUnitElement elementB = element.parts[1]; |
263 // // "match" should be passed to "listener" | 339 index.indexUnit(context, elementA.node); |
264 // _filteredListener.matchFound(_match); | 340 index.indexUnit(context, elementB.node); |
265 // verifyNoMoreInteractions(_listener); | 341 Element mainElement = findElement('main'); |
266 // } | 342 var expected = [ |
267 // | 343 new ExpectedMatch( |
268 // void test_matchFound_filterTrue() { | 344 elementA, |
269 // when(_filter.passes(_match)).thenReturn(true); | 345 MatchKind.LIBRARY_REFERENCE, |
270 // // "match" should be passed to "listener" | 346 codeA.indexOf('lib; // A'), |
271 // _filteredListener.matchFound(_match); | 347 'lib'.length), |
272 // verify(_listener).matchFound(_match); | 348 new ExpectedMatch( |
273 // verifyNoMoreInteractions(_listener); | 349 elementB, |
274 // } | 350 MatchKind.LIBRARY_REFERENCE, |
275 // | 351 codeB.indexOf('lib; // B'), |
276 // void test_searchComplete() { | 352 'lib'.length),]; |
277 // _filteredListener.searchComplete(); | 353 return _verifyReferences(element, expected); |
278 // verify(_listener).searchComplete(); | 354 } |
279 // verifyNoMoreInteractions(_listener); | 355 |
280 // } | 356 Future test_searchReferences_LocalVariableElement() { |
281 // | 357 _indexTestUnit(''' |
282 // static dartSuite() { | 358 main() { |
283 // _ut.group('FilterSearchListenerTest', () { | 359 var v; |
284 // _ut.test('test_matchFound_filterFalse', () { | 360 v = 1; |
285 // final __test = new FilterSearchListenerTest(); | 361 v += 2; |
286 // runJUnitTest(__test, __test.test_matchFound_filterFalse); | 362 print(v); |
287 // }); | 363 v(); |
288 // _ut.test('test_matchFound_filterTrue', () { | 364 } |
289 // final __test = new FilterSearchListenerTest(); | 365 '''); |
290 // runJUnitTest(__test, __test.test_matchFound_filterTrue); | 366 LocalVariableElement element = findElement('v'); |
291 // }); | 367 Element mainElement = findElement('main'); |
292 // _ut.test('test_searchComplete', () { | 368 var expected = [ |
293 // final __test = new FilterSearchListenerTest(); | 369 _expectId(mainElement, MatchKind.VARIABLE_WRITE, 'v = 1;'), |
294 // runJUnitTest(__test, __test.test_searchComplete); | 370 _expectId(mainElement, MatchKind.VARIABLE_READ_WRITE, 'v += 2;'), |
295 // }); | 371 _expectId(mainElement, MatchKind.VARIABLE_READ, 'v);'), |
296 // }); | 372 _expectId(mainElement, MatchKind.FUNCTION_EXECUTION, 'v();')]; |
297 // } | 373 return _verifyReferences(element, expected); |
298 //} | 374 } |
299 // | 375 |
300 //class GatheringSearchListenerTest extends EngineTestCase { | 376 Future test_searchReferences_MethodElement() { |
301 // SearchMatch _matchA = mock(SearchMatch); | 377 _indexTestUnit(''' |
302 // | 378 class A { |
303 // SearchMatch _matchB = mock(SearchMatch); | 379 m() {} |
304 // | 380 main() { |
305 // GatheringSearchListener _gatheringListener = new GatheringSearchListener(); | 381 m(); // 1 |
306 // | 382 this.m(); // 2 |
307 // void test_matchFound() { | 383 print(m); // 3 |
308 // Element elementA = mock(Element); | 384 print(this.m); // 4 |
309 // Element elementB = mock(Element); | 385 } |
310 // when(elementA.displayName).thenReturn("A"); | 386 } |
311 // when(elementB.displayName).thenReturn("B"); | 387 '''); |
312 // when(_matchA.element).thenReturn(elementA); | 388 MethodElement method = findElement('m'); |
313 // when(_matchB.element).thenReturn(elementB); | 389 Element mainElement = findElement('main'); |
314 // // matchB | 390 var expected = [ |
315 // _gatheringListener.matchFound(_matchB); | 391 _expectId(mainElement, MatchKind.METHOD_INVOCATION, 'm(); // 1'), |
316 // JUnitTestCase.assertFalse(_gatheringListener.isComplete); | 392 _expectIdQ(mainElement, MatchKind.METHOD_INVOCATION, 'm(); // 2'), |
317 // assertThat(_gatheringListener.matches).containsExactly(_matchB); | 393 _expectId(mainElement, MatchKind.METHOD_REFERENCE, 'm); // 3'), |
318 // // matchA | 394 _expectIdQ(mainElement, MatchKind.METHOD_REFERENCE, 'm); // 4')]; |
319 // _gatheringListener.matchFound(_matchA); | 395 return _verifyReferences(method, expected); |
320 // JUnitTestCase.assertFalse(_gatheringListener.isComplete); | 396 } |
321 // assertThat(_gatheringListener.matches).containsExactly(_matchA, _matchB); | 397 |
322 // } | 398 Future test_searchReferences_MethodMember() { |
323 // | 399 _indexTestUnit(''' |
324 // void test_searchComplete() { | 400 class A<T> { |
325 // JUnitTestCase.assertFalse(_gatheringListener.isComplete); | 401 T m() => null; |
326 // // complete | 402 } |
327 // _gatheringListener.searchComplete(); | 403 main(A<int> a) { |
328 // JUnitTestCase.assertTrue(_gatheringListener.isComplete); | 404 a.m(); // ref |
329 // } | 405 } |
330 // | 406 '''); |
331 // static dartSuite() { | 407 MethodMember method = findNodeElementAtString('m(); // ref'); |
332 // _ut.group('GatheringSearchListenerTest', () { | 408 Element mainElement = findElement('main'); |
333 // _ut.test('test_matchFound', () { | 409 var expected = [ |
334 // final __test = new GatheringSearchListenerTest(); | 410 _expectIdQ(mainElement, MatchKind.METHOD_INVOCATION, 'm(); // ref')]; |
335 // runJUnitTest(__test, __test.test_matchFound); | 411 return _verifyReferences(method, expected); |
336 // }); | 412 } |
337 // _ut.test('test_searchComplete', () { | 413 |
338 // final __test = new GatheringSearchListenerTest(); | 414 Future test_searchReferences_ParameterElement() { |
339 // runJUnitTest(__test, __test.test_searchComplete); | 415 _indexTestUnit(''' |
340 // }); | 416 foo({p}) { |
341 // }); | 417 p = 1; |
342 // } | 418 p += 2; |
343 //} | 419 print(p); |
344 // | 420 p(); |
345 //class LibrarySearchScopeTest extends EngineTestCase { | 421 } |
346 // LibraryElement _libraryA = mock(LibraryElement); | 422 main() { |
347 // | 423 foo(p: 42); |
348 // LibraryElement _libraryB = mock(LibraryElement); | 424 } |
349 // | 425 '''); |
350 // Element _element = mock(Element); | 426 ParameterElement element = findElement('p'); |
351 // | 427 Element fooElement = findElement('foo'); |
352 // void test_arrayConstructor_inA_false() { | 428 Element mainElement = findElement('main'); |
353 // when(_element.getAncestor((element) => element is LibraryElement)).thenRet
urn(_libraryB); | 429 var expected = [ |
354 // LibrarySearchScope scope = new LibrarySearchScope.con2([_libraryA]); | 430 _expectId(fooElement, MatchKind.VARIABLE_WRITE, 'p = 1;'), |
355 // assertThat(scope.libraries).containsOnly(_libraryA); | 431 _expectId(fooElement, MatchKind.VARIABLE_READ_WRITE, 'p += 2;'), |
356 // JUnitTestCase.assertFalse(scope.encloses(_element)); | 432 _expectId(fooElement, MatchKind.VARIABLE_READ, 'p);'), |
357 // } | 433 _expectId(fooElement, MatchKind.FUNCTION_EXECUTION, 'p();'), |
358 // | 434 _expectId(mainElement, MatchKind.NAMED_PARAMETER_REFERENCE, 'p: 42')]; |
359 // void test_arrayConstructor_inA_true() { | 435 return _verifyReferences(element, expected); |
360 // when(_element.getAncestor((element) => element is LibraryElement)).thenRet
urn(_libraryA); | 436 } |
361 // LibrarySearchScope scope = new LibrarySearchScope.con2([_libraryA, _librar
yB]); | 437 |
362 // assertThat(scope.libraries).containsOnly(_libraryA, _libraryB); | 438 Future test_searchReferences_PropertyAccessorElement_getter() { |
363 // JUnitTestCase.assertTrue(scope.encloses(_element)); | 439 _indexTestUnit(''' |
364 // } | 440 class A { |
365 // | 441 get g => null; |
366 // void test_collectionConstructor_inB() { | 442 main() { |
367 // when(_element.getAncestor((element) => element is LibraryElement)).thenRet
urn(_libraryB); | 443 g; // 1 |
368 // LibrarySearchScope scope = new LibrarySearchScope.con1(ImmutableSet.of(_li
braryA, _libraryB)); | 444 this.g; // 2 |
369 // assertThat(scope.libraries).containsOnly(_libraryA, _libraryB); | 445 } |
370 // JUnitTestCase.assertTrue(scope.encloses(_element)); | 446 } |
371 // } | 447 '''); |
372 // | 448 PropertyAccessorElement element = findElement('g', ElementKind.GETTER); |
373 // static dartSuite() { | 449 Element mainElement = findElement('main'); |
374 // _ut.group('LibrarySearchScopeTest', () { | 450 var expected = [ |
375 // _ut.test('test_arrayConstructor_inA_false', () { | 451 _expectId(mainElement, MatchKind.PROPERTY_ACCESSOR_REFERENCE, 'g; // 1')
, |
376 // final __test = new LibrarySearchScopeTest(); | 452 _expectIdQ(mainElement, MatchKind.PROPERTY_ACCESSOR_REFERENCE, 'g; // 2'
)]; |
377 // runJUnitTest(__test, __test.test_arrayConstructor_inA_false); | 453 return _verifyReferences(element, expected); |
378 // }); | 454 } |
379 // _ut.test('test_arrayConstructor_inA_true', () { | 455 |
380 // final __test = new LibrarySearchScopeTest(); | 456 Future test_searchReferences_PropertyAccessorElement_setter() { |
381 // runJUnitTest(__test, __test.test_arrayConstructor_inA_true); | 457 _indexTestUnit(''' |
382 // }); | 458 class A { |
383 // _ut.test('test_collectionConstructor_inB', () { | 459 set s(x) {} |
384 // final __test = new LibrarySearchScopeTest(); | 460 main() { |
385 // runJUnitTest(__test, __test.test_collectionConstructor_inB); | 461 s = 1; |
386 // }); | 462 this.s = 2; |
387 // }); | 463 } |
388 // } | 464 } |
389 //} | 465 '''); |
390 // | 466 PropertyAccessorElement element = findElement('s='); |
391 //class NameMatchingSearchListenerTest extends EngineTestCase { | 467 Element mainElement = findElement('main'); |
392 // SearchListener _listener = mock(SearchListener); | 468 var expected = [ |
393 // | 469 _expectId(mainElement, MatchKind.PROPERTY_ACCESSOR_REFERENCE, 's = 1'), |
394 // Element _element = mock(Element); | 470 _expectIdQ(mainElement, MatchKind.PROPERTY_ACCESSOR_REFERENCE, 's = 2')]
; |
395 // | 471 return _verifyReferences(element, expected); |
396 // SearchMatch _match = mock(SearchMatch); | 472 } |
397 // | 473 |
398 // SearchPattern _pattern = mock(SearchPattern); | 474 Future test_searchReferences_TopLevelVariableElement() { |
399 // | 475 addSource('/lib.dart', ''' |
400 // SearchListener _nameMatchingListener = new NameMatchingSearchListener(_patte
rn, _listener); | 476 library lib; |
401 // | 477 var V; |
402 // void test_matchFound_patternFalse() { | 478 '''); |
403 // when(_pattern.matches(_element)).thenReturn(null); | 479 _indexTestUnit(''' |
404 // // verify | 480 import 'lib.dart' show V; // imp |
405 // _nameMatchingListener.matchFound(_match); | 481 import 'lib.dart' as pref; |
406 // verifyNoMoreInteractions(_listener); | 482 main() { |
407 // } | 483 V = 1; |
408 // | 484 print(V); |
409 // void test_matchFound_patternTrue() { | 485 V(); |
410 // when(_pattern.matches(_element)).thenReturn(MatchQuality.EXACT); | 486 } |
411 // // verify | 487 mainQ() { |
412 // _nameMatchingListener.matchFound(_match); | 488 pref.V = 1; // Q |
413 // verify(_listener).matchFound(_match); | 489 print(pref.V); // Q |
414 // verifyNoMoreInteractions(_listener); | 490 pref.V(); // Q |
415 // } | 491 } |
416 // | 492 '''); |
417 // @override | 493 ImportElement importElement = testLibraryElement.imports[0]; |
418 // void setUp() { | 494 CompilationUnitElement impUnit = |
419 // super.setUp(); | 495 importElement.importedLibrary.definingCompilationUnit; |
420 // when(_match.element).thenReturn(_element); | 496 TopLevelVariableElement variable = impUnit.topLevelVariables[0]; |
421 // } | 497 Element main = findElement('main'); |
422 // | 498 Element mainQ = findElement('mainQ'); |
423 // static dartSuite() { | 499 var expected = [ |
424 // _ut.group('NameMatchingSearchListenerTest', () { | 500 _expectIdQ(testUnitElement, MatchKind.FIELD_REFERENCE, 'V; // imp'), |
425 // _ut.test('test_matchFound_patternFalse', () { | 501 _expectId(main, MatchKind.FIELD_WRITE, 'V = 1;'), |
426 // final __test = new NameMatchingSearchListenerTest(); | 502 _expectId(main, MatchKind.FIELD_READ, 'V);'), |
427 // runJUnitTest(__test, __test.test_matchFound_patternFalse); | 503 _expectId(main, MatchKind.FIELD_INVOCATION, 'V();'), |
428 // }); | 504 _expectIdQ(mainQ, MatchKind.FIELD_WRITE, 'V = 1; // Q'), |
429 // _ut.test('test_matchFound_patternTrue', () { | 505 _expectIdQ(mainQ, MatchKind.FIELD_READ, 'V); // Q'), |
430 // final __test = new NameMatchingSearchListenerTest(); | 506 _expectIdQ(mainQ, MatchKind.FIELD_INVOCATION, 'V(); // Q')]; |
431 // runJUnitTest(__test, __test.test_matchFound_patternTrue); | 507 return _verifyReferences(variable, expected); |
432 // }); | 508 } |
433 // }); | 509 |
434 // } | 510 Future test_searchReferences_TypeParameterElement() { |
435 //} | 511 _indexTestUnit(''' |
436 // | 512 class A<T> { |
437 //class OrSearchPatternTest extends EngineTestCase { | 513 main(T a, T b) {} |
438 // Element _element = mock(Element); | 514 } |
439 // | 515 '''); |
440 // SearchPattern _patternA = mock(SearchPattern); | 516 TypeParameterElement element = findElement('T'); |
441 // | 517 Element aElement = findElement('a'); |
442 // SearchPattern _patternB = mock(SearchPattern); | 518 Element bElement = findElement('b'); |
443 // | 519 var expected = [ |
444 // SearchPattern _pattern = new OrSearchPattern([_patternA, _patternB]); | 520 _expectId(aElement, MatchKind.TYPE_PARAMETER_REFERENCE, 'T a'), |
445 // | 521 _expectId(bElement, MatchKind.TYPE_PARAMETER_REFERENCE, 'T b')]; |
446 // void test_allExact() { | 522 return _verifyReferences(element, expected); |
447 // when(_patternA.matches(_element)).thenReturn(MatchQuality.EXACT); | 523 } |
448 // when(_patternB.matches(_element)).thenReturn(MatchQuality.EXACT); | 524 |
449 // // validate | 525 Future test_searchSubtypes() { |
450 // JUnitTestCase.assertSame(MatchQuality.EXACT, _pattern.matches(_element)); | 526 _indexTestUnit(''' |
451 // } | 527 class T {} |
452 // | 528 class A extends T {} // A |
453 // void test_ExactName() { | 529 class B = Object with T; // B |
454 // when(_patternA.matches(_element)).thenReturn(MatchQuality.EXACT); | 530 class C implements T {} // C |
455 // when(_patternB.matches(_element)).thenReturn(MatchQuality.NAME); | 531 '''); |
456 // // validate | 532 ClassElement element = findElement('T'); |
457 // JUnitTestCase.assertSame(MatchQuality.EXACT, _pattern.matches(_element)); | 533 ClassElement elementA = findElement('A'); |
458 // } | 534 ClassElement elementB = findElement('B'); |
459 // | 535 ClassElement elementC = findElement('C'); |
460 // void test_NameExact() { | 536 var expected = [ |
461 // when(_patternA.matches(_element)).thenReturn(MatchQuality.NAME); | 537 _expectId(elementA, MatchKind.EXTENDS_REFERENCE, 'T {} // A'), |
462 // when(_patternB.matches(_element)).thenReturn(MatchQuality.EXACT); | 538 _expectId(elementB, MatchKind.WITH_REFERENCE, 'T; // B'), |
463 // // validate | 539 _expectId(elementC, MatchKind.IMPLEMENTS_REFERENCE, 'T {} // C')]; |
464 // JUnitTestCase.assertSame(MatchQuality.NAME, _pattern.matches(_element)); | 540 return searchEngine.searchSubtypes(element).then((matches) { |
465 // } | 541 _assertMatches(matches, expected); |
466 // | 542 }); |
467 // void test_NullNull() { | 543 } |
468 // when(_patternA.matches(_element)).thenReturn(null); | 544 |
469 // when(_patternB.matches(_element)).thenReturn(null); | 545 Future test_searchMemberReferences() { |
470 // // validate | 546 _indexTestUnit(''' |
471 // JUnitTestCase.assertSame(null, _pattern.matches(_element)); | 547 class A { |
472 // } | 548 var test; // A |
473 // | 549 mainA() { |
474 // static dartSuite() { | 550 test(); // a-inv-r-nq |
475 // _ut.group('OrSearchPatternTest', () { | 551 test = 1; // a-write-r-nq |
476 // _ut.test('test_ExactName', () { | 552 test += 2; // a-read-write-r-nq |
477 // final __test = new OrSearchPatternTest(); | 553 print(test); // a-read-r-nq |
478 // runJUnitTest(__test, __test.test_ExactName); | 554 } |
479 // }); | 555 } |
480 // _ut.test('test_NameExact', () { | 556 main(A a, p) { |
481 // final __test = new OrSearchPatternTest(); | 557 a.test(); // a-inv-r-q |
482 // runJUnitTest(__test, __test.test_NameExact); | 558 a.test = 1; // a-write-r-q |
483 // }); | 559 a.test += 2; // a-read-write-r-q |
484 // _ut.test('test_NullNull', () { | 560 print(a.test); // a-read-r-q |
485 // final __test = new OrSearchPatternTest(); | 561 p.test(); // p-inv-ur-q |
486 // runJUnitTest(__test, __test.test_NullNull); | 562 p.test = 1; // p-write-ur-q |
487 // }); | 563 p.test += 2; // p-read-write-ur-q |
488 // _ut.test('test_allExact', () { | 564 print(p.test); // p-read-ur-q |
489 // final __test = new OrSearchPatternTest(); | 565 } |
490 // runJUnitTest(__test, __test.test_allExact); | 566 '''); |
491 // }); | 567 ClassElement elementA = findElement('A'); |
492 // }); | 568 ClassElement elementB = findElement('B'); |
493 // } | 569 Element mainA = findElement('mainA'); |
494 //} | 570 Element main = findElement('main'); |
495 // | 571 var expected = [ |
496 //class PrefixSearchPatternTest extends EngineTestCase { | 572 _expectId(mainA, MatchKind.NAME_INVOCATION_RESOLVED, 'test(); // a-inv-r
-nq'), |
497 // Element _element = mock(Element); | 573 _expectId(mainA, MatchKind.NAME_WRITE_RESOLVED, 'test = 1; // a-write-r-
nq'), |
498 // | 574 _expectId(mainA, MatchKind.NAME_READ_WRITE_RESOLVED, 'test += 2; // a-re
ad-write-r-nq'), |
499 // void test_caseInsensitive_contentMatch_caseMatch() { | 575 _expectId(mainA, MatchKind.NAME_READ_RESOLVED, 'test); // a-read-r-nq'), |
500 // SearchPattern pattern = new PrefixSearchPattern("HashMa", false); | 576 _expectId(main, MatchKind.NAME_INVOCATION_RESOLVED, 'test(); // a-inv-r-
q'), |
501 // when(_element.displayName).thenReturn("HashMap"); | 577 _expectId(main, MatchKind.NAME_WRITE_RESOLVED, 'test = 1; // a-write-r-q
'), |
502 // // validate | 578 _expectId(main, MatchKind.NAME_READ_WRITE_RESOLVED, 'test += 2; // a-rea
d-write-r-q'), |
503 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | 579 _expectId(main, MatchKind.NAME_READ_RESOLVED, 'test); // a-read-r-q'), |
504 // } | 580 _expectIdU(main, MatchKind.NAME_INVOCATION_UNRESOLVED, 'test(); // p-inv
-ur-q'), |
505 // | 581 _expectIdU(main, MatchKind.NAME_WRITE_UNRESOLVED, 'test = 1; // p-write-
ur-q'), |
506 // void test_caseInsensitive_contentMatch_caseMismatch() { | 582 _expectIdU(main, MatchKind.NAME_READ_WRITE_UNRESOLVED, 'test += 2; // p-
read-write-ur-q'), |
507 // SearchPattern pattern = new PrefixSearchPattern("HaSHMa", false); | 583 _expectIdU(main, MatchKind.NAME_READ_UNRESOLVED, 'test); // p-read-ur-q'
), |
508 // when(_element.displayName).thenReturn("hashMaP"); | 584 ]; |
509 // // validate | 585 return searchEngine.searchMemberReferences('test').then((matches) { |
510 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | 586 _assertMatches(matches, expected); |
511 // } | 587 }); |
512 // | 588 } |
513 // void test_caseInsensitive_contentMismatch() { | 589 |
514 // SearchPattern pattern = new PrefixSearchPattern("HashMa", false); | 590 Future test_searchTopLevelDeclarations() { |
515 // when(_element.displayName).thenReturn("HashTable"); | 591 _indexTestUnit(''' |
516 // // validate | 592 class A {} // A |
517 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | 593 class B = Object with A; |
518 // } | 594 typedef C(); |
519 // | 595 D() {} |
520 // void test_caseSensitive_contentMatch() { | 596 var E = null; |
521 // SearchPattern pattern = new PrefixSearchPattern("HashMa", true); | 597 class NoMatchABCDE {} |
522 // when(_element.displayName).thenReturn("HashMap"); | 598 '''); |
523 // // validate | 599 NameElement element = new NameElement('test'); |
524 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | 600 Element topA = findElement('A'); |
525 // } | 601 Element topB = findElement('B'); |
526 // | 602 Element topC = findElement('C'); |
527 // void test_caseSensitive_contentMismatch() { | 603 Element topD = findElement('D'); |
528 // SearchPattern pattern = new PrefixSearchPattern("HashMa", true); | 604 Element topE = findElement('E'); |
529 // when(_element.displayName).thenReturn("HashTable"); | 605 Element topNoMatch = new MockElement('NoMatchABCDE'); |
530 // // validate | 606 var expected = [ |
531 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | 607 _expectId(topA, MatchKind.CLASS_DECLARATION, 'A {} // A'), |
532 // } | 608 _expectId(topB, MatchKind.CLASS_ALIAS_DECLARATION, 'B ='), |
533 // | 609 _expectId(topC, MatchKind.FUNCTION_TYPE_DECLARATION, 'C()'), |
534 // void test_nullElement() { | 610 _expectId(topD, MatchKind.FUNCTION_DECLARATION, 'D() {}'), |
535 // SearchPattern pattern = new PrefixSearchPattern("HashMa", false); | 611 _expectId(topE, MatchKind.VARIABLE_DECLARATION, 'E = null')]; |
536 // // validate | 612 return _verifyTopLevelDeclarations('^[A-E]\$', expected); |
537 // JUnitTestCase.assertSame(null, pattern.matches(null)); | 613 } |
538 // } | 614 |
539 // | 615 ExpectedMatch _expectId(Element element, MatchKind kind, String search, |
540 // void test_nullName() { | 616 {int length, bool isResolved: true, bool isQualified: false}) { |
541 // SearchPattern pattern = new PrefixSearchPattern("HashMa", false); | 617 int offset = findOffset(search); |
542 // when(_element.displayName).thenReturn(null); | 618 if (length == null) { |
543 // // validate | 619 length = getLeadingIdentifierLength(search); |
544 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | 620 } |
545 // } | 621 return new ExpectedMatch( |
546 // | 622 element, |
547 // static dartSuite() { | 623 kind, |
548 // _ut.group('PrefixSearchPatternTest', () { | 624 offset, |
549 // _ut.test('test_caseInsensitive_contentMatch_caseMatch', () { | 625 length, |
550 // final __test = new PrefixSearchPatternTest(); | 626 isResolved: isResolved, |
551 // runJUnitTest(__test, __test.test_caseInsensitive_contentMatch_caseMatc
h); | 627 isQualified: isQualified); |
552 // }); | 628 } |
553 // _ut.test('test_caseInsensitive_contentMatch_caseMismatch', () { | 629 |
554 // final __test = new PrefixSearchPatternTest(); | 630 ExpectedMatch _expectIdQ(Element element, MatchKind kind, String search) { |
555 // runJUnitTest(__test, __test.test_caseInsensitive_contentMatch_caseMism
atch); | 631 return _expectId(element, kind, search, isQualified: true); |
556 // }); | 632 } |
557 // _ut.test('test_caseInsensitive_contentMismatch', () { | 633 |
558 // final __test = new PrefixSearchPatternTest(); | 634 ExpectedMatch _expectIdU(Element element, MatchKind kind, String search) { |
559 // runJUnitTest(__test, __test.test_caseInsensitive_contentMismatch); | 635 return _expectId(element, kind, search, isResolved: false); |
560 // }); | 636 } |
561 // _ut.test('test_caseSensitive_contentMatch', () { | 637 |
562 // final __test = new PrefixSearchPatternTest(); | 638 void _indexTestUnit(String code) { |
563 // runJUnitTest(__test, __test.test_caseSensitive_contentMatch); | 639 resolveTestUnit(code); |
564 // }); | 640 index.indexUnit(context, testUnit); |
565 // _ut.test('test_caseSensitive_contentMismatch', () { | 641 } |
566 // final __test = new PrefixSearchPatternTest(); | 642 |
567 // runJUnitTest(__test, __test.test_caseSensitive_contentMismatch); | 643 Future _verifyReferences(Element element, |
568 // }); | 644 List<ExpectedMatch> expectedMatches) { |
569 // _ut.test('test_nullElement', () { | 645 return searchEngine.searchReferences( |
570 // final __test = new PrefixSearchPatternTest(); | 646 element).then((List<SearchMatch> matches) { |
571 // runJUnitTest(__test, __test.test_nullElement); | 647 _assertMatches(matches, expectedMatches); |
572 // }); | 648 }); |
573 // _ut.test('test_nullName', () { | 649 } |
574 // final __test = new PrefixSearchPatternTest(); | 650 |
575 // runJUnitTest(__test, __test.test_nullName); | 651 Future _verifyTopLevelDeclarations(String pattern, |
576 // }); | 652 List<ExpectedMatch> expectedMatches) { |
577 // }); | 653 return searchEngine.searchTopLevelDeclarations( |
578 // } | 654 pattern).then((List<SearchMatch> matches) { |
579 //} | 655 _assertMatches(matches, expectedMatches); |
580 // | 656 }); |
581 //class RegularExpressionSearchPatternTest extends EngineTestCase { | 657 } |
582 // Element _element = mock(Element); | 658 |
583 // | 659 static void _assertMatches(List<SearchMatch> matches, |
584 // void test_caseInsensitive_false_contentMismatch() { | 660 List<ExpectedMatch> expectedMatches) { |
585 // SearchPattern pattern = new RegularExpressionSearchPattern("H[a-z]*Map", f
alse); | 661 expect(matches, unorderedEquals(expectedMatches)); |
586 // when(_element.displayName).thenReturn("Maps"); | 662 } |
587 // // validate | 663 } |
588 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
589 // } | |
590 // | |
591 // void test_caseInsensitive_true_caseMismatch() { | |
592 // SearchPattern pattern = new RegularExpressionSearchPattern("H[a-z]*MaP", f
alse); | |
593 // when(_element.displayName).thenReturn("HashMap"); | |
594 // // validate | |
595 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | |
596 // } | |
597 // | |
598 // void test_caseSensitive_false_caseMismatch() { | |
599 // SearchPattern pattern = new RegularExpressionSearchPattern("H[a-z]*MaP", t
rue); | |
600 // when(_element.displayName).thenReturn("HashMap"); | |
601 // // validate | |
602 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
603 // } | |
604 // | |
605 // void test_caseSensitive_false_contentMismatch() { | |
606 // SearchPattern pattern = new RegularExpressionSearchPattern("H[a-z]*Map", t
rue); | |
607 // when(_element.displayName).thenReturn("Maps"); | |
608 // // validate | |
609 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
610 // } | |
611 // | |
612 // void test_caseSensitive_true() { | |
613 // SearchPattern pattern = new RegularExpressionSearchPattern("H.*Map", true)
; | |
614 // when(_element.displayName).thenReturn("HashMap"); | |
615 // // validate | |
616 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | |
617 // } | |
618 // | |
619 // void test_nullElement() { | |
620 // SearchPattern pattern = new RegularExpressionSearchPattern("H.*Map", true)
; | |
621 // // validate | |
622 // JUnitTestCase.assertSame(null, pattern.matches(null)); | |
623 // } | |
624 // | |
625 // void test_nullName() { | |
626 // SearchPattern pattern = new RegularExpressionSearchPattern("H.*Map", true)
; | |
627 // when(_element.displayName).thenReturn(null); | |
628 // // validate | |
629 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
630 // } | |
631 // | |
632 // static dartSuite() { | |
633 // _ut.group('RegularExpressionSearchPatternTest', () { | |
634 // _ut.test('test_caseInsensitive_false_contentMismatch', () { | |
635 // final __test = new RegularExpressionSearchPatternTest(); | |
636 // runJUnitTest(__test, __test.test_caseInsensitive_false_contentMismatch
); | |
637 // }); | |
638 // _ut.test('test_caseInsensitive_true_caseMismatch', () { | |
639 // final __test = new RegularExpressionSearchPatternTest(); | |
640 // runJUnitTest(__test, __test.test_caseInsensitive_true_caseMismatch); | |
641 // }); | |
642 // _ut.test('test_caseSensitive_false_caseMismatch', () { | |
643 // final __test = new RegularExpressionSearchPatternTest(); | |
644 // runJUnitTest(__test, __test.test_caseSensitive_false_caseMismatch); | |
645 // }); | |
646 // _ut.test('test_caseSensitive_false_contentMismatch', () { | |
647 // final __test = new RegularExpressionSearchPatternTest(); | |
648 // runJUnitTest(__test, __test.test_caseSensitive_false_contentMismatch); | |
649 // }); | |
650 // _ut.test('test_caseSensitive_true', () { | |
651 // final __test = new RegularExpressionSearchPatternTest(); | |
652 // runJUnitTest(__test, __test.test_caseSensitive_true); | |
653 // }); | |
654 // _ut.test('test_nullElement', () { | |
655 // final __test = new RegularExpressionSearchPatternTest(); | |
656 // runJUnitTest(__test, __test.test_nullElement); | |
657 // }); | |
658 // _ut.test('test_nullName', () { | |
659 // final __test = new RegularExpressionSearchPatternTest(); | |
660 // runJUnitTest(__test, __test.test_nullName); | |
661 // }); | |
662 // }); | |
663 // } | |
664 //} | |
665 // | |
666 //class SearchEngineImplTest extends EngineTestCase { | |
667 // static void _assertMatches(List<SearchMatch> matches, List<SearchEngineImplT
est_ExpectedMatch> expectedMatches) { | |
668 // assertThat(matches).hasSize(expectedMatches.length); | |
669 // for (SearchMatch match in matches) { | |
670 // bool found = false; | |
671 // String msg = match.toString(); | |
672 // for (SearchEngineImplTest_ExpectedMatch expectedMatch in expectedMatches
) { | |
673 // if (match.element == expectedMatch._element && match.kind == expectedM
atch._kind && match.quality == expectedMatch._quality && match.sourceRange == ex
pectedMatch._range && match.isQualified == expectedMatch._qualified) { | |
674 // found = true; | |
675 // break; | |
676 // } | |
677 // } | |
678 // if (!found) { | |
679 // JUnitTestCase.fail("Not found: ${msg}"); | |
680 // } | |
681 // } | |
682 // } | |
683 // | |
684 // IndexStore _indexStore = IndexFactory.newSplitIndexStore(new MemoryNodeManag
er()); | |
685 // | |
686 // static AnalysisContext _CONTEXT = mock(AnalysisContext); | |
687 // | |
688 // int _nextLocationId = 0; | |
689 // | |
690 // SearchScope _scope; | |
691 // | |
692 // SearchPattern _pattern = null; | |
693 // | |
694 // SearchFilter _filter = null; | |
695 // | |
696 // Source _source = mock(Source); | |
697 // | |
698 // CompilationUnitElement _unitElement = mock(CompilationUnitElement); | |
699 // | |
700 // LibraryElement _libraryElement = mock(LibraryElement); | |
701 // | |
702 // Element _elementA = _mockElement(Element, ElementKind.CLASS); | |
703 // | |
704 // Element _elementB = _mockElement(Element, ElementKind.CLASS); | |
705 // | |
706 // Element _elementC = _mockElement(Element, ElementKind.CLASS); | |
707 // | |
708 // Element _elementD = _mockElement(Element, ElementKind.CLASS); | |
709 // | |
710 // Element _elementE = _mockElement(Element, ElementKind.CLASS); | |
711 // | |
712 // void fail_searchAssignedTypes_assignments() { | |
713 // // TODO(scheglov) does not work - new split index store cannot store types
(yet?) | |
714 // PropertyAccessorElement setterElement = _mockElement(PropertyAccessorEleme
nt, ElementKind.SETTER); | |
715 // FieldElement fieldElement = _mockElement(FieldElement, ElementKind.FIELD); | |
716 // when(fieldElement.setter).thenReturn(setterElement); | |
717 // DartType typeA = mock(DartType); | |
718 // DartType typeB = mock(DartType); | |
719 // DartType typeC = mock(DartType); | |
720 // _indexStore.aboutToIndexDart(_CONTEXT, _unitElement); | |
721 // { | |
722 // Location location = new Location(_elementA, 1, 10); | |
723 // location = new LocationWithData<DartType>.con1(location, typeA); | |
724 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_QUALIFIED, location); | |
725 // } | |
726 // { | |
727 // Location location = new Location(_elementB, 2, 20); | |
728 // location = new LocationWithData<DartType>.con1(location, typeB); | |
729 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_UNQUALIFIED, location); | |
730 // } | |
731 // // will be filtered by scope | |
732 // { | |
733 // Location location = new Location(_elementC, 3, 30); | |
734 // location = new LocationWithData<DartType>.con1(location, typeC); | |
735 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_QUALIFIED, location); | |
736 // } | |
737 // // not LocationWithData | |
738 // { | |
739 // Location location = new Location(_elementD, 4, 40); | |
740 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_QUALIFIED, location); | |
741 // } | |
742 // _indexStore.doneIndex(); | |
743 // // ask types | |
744 // Set<DartType> types = _runSearch(new SearchRunner_SearchEngineImplTest_fai
l_searchAssignedTypes_assignments(fieldElement)); | |
745 // assertThat(types).containsOnly(typeA, typeB); | |
746 // } | |
747 // | |
748 // void fail_searchAssignedTypes_initializers() { | |
749 // // TODO(scheglov) does not work - new split index store cannot store types
(yet?) | |
750 // FieldElement fieldElement = _mockElement(FieldElement, ElementKind.FIELD); | |
751 // DartType typeA = mock(DartType); | |
752 // DartType typeB = mock(DartType); | |
753 // { | |
754 // Location location = new Location(_elementA, 10, 1); | |
755 // location = new LocationWithData<DartType>.con1(location, typeA); | |
756 // _indexStore.recordRelationship(fieldElement, IndexConstants.IS_DEFINED_B
Y, location); | |
757 // } | |
758 // { | |
759 // Location location = new Location(_elementB, 20, 1); | |
760 // location = new LocationWithData<DartType>.con1(location, typeB); | |
761 // _indexStore.recordRelationship(fieldElement, IndexConstants.IS_REFERENCE
D_BY, location); | |
762 // } | |
763 // _indexStore.doneIndex(); | |
764 // // ask types | |
765 // Set<DartType> types = _runSearch(new SearchRunner_SearchEngineImplTest_fai
l_searchAssignedTypes_initializers(fieldElement)); | |
766 // assertThat(types).containsOnly(typeA, typeB); | |
767 // } | |
768 // | |
769 // void test_searchDeclarations_String() { | |
770 // Element referencedElement = new NameElementImpl("test"); | |
771 // { | |
772 // Location locationA = new Location(_elementA, 1, 2); | |
773 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_DEFI
NED_BY, locationA); | |
774 // } | |
775 // { | |
776 // Location locationB = new Location(_elementB, 10, 20); | |
777 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_DEFI
NED_BY, locationB); | |
778 // } | |
779 // _indexStore.doneIndex(); | |
780 // // search matches | |
781 // List<SearchMatch> matches = _runSearch(new SearchRunner_SearchEngineImplTe
st_test_searchDeclarations_String(this)); | |
782 // // verify | |
783 // _assertMatches(matches, [ | |
784 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.NAME_
DECLARATION, 1, 2), | |
785 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.NAME_
DECLARATION, 10, 20)]); | |
786 // } | |
787 // | |
788 // void test_searchFunctionDeclarations() { | |
789 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
790 // _defineFunctionsAB(library); | |
791 // _scope = new LibrarySearchScope.con2([library]); | |
792 // // search matches | |
793 // List<SearchMatch> matches = _searchFunctionDeclarationsSync(); | |
794 // // verify | |
795 // _assertMatches(matches, [ | |
796 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.FUNCT
ION_DECLARATION, 1, 2), | |
797 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.FUNCT
ION_DECLARATION, 10, 20)]); | |
798 // } | |
799 // | |
800 // void test_searchFunctionDeclarations_async() { | |
801 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
802 // _defineFunctionsAB(library); | |
803 // _scope = new LibrarySearchScope.con2([library]); | |
804 // // search matches | |
805 // List<SearchMatch> matches = _searchFunctionDeclarationsAsync(); | |
806 // // verify | |
807 // _assertMatches(matches, [ | |
808 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.FUNCT
ION_DECLARATION, 1, 2), | |
809 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.FUNCT
ION_DECLARATION, 10, 20)]); | |
810 // } | |
811 // | |
812 // void test_searchFunctionDeclarations_inUniverse() { | |
813 // { | |
814 // Location locationA = new Location(_elementA, 1, 2); | |
815 // _indexStore.recordRelationship(IndexConstants.UNIVERSE, IndexConstants.D
EFINES_FUNCTION, locationA); | |
816 // } | |
817 // { | |
818 // Location locationB = new Location(_elementB, 10, 20); | |
819 // _indexStore.recordRelationship(IndexConstants.UNIVERSE, IndexConstants.D
EFINES_FUNCTION, locationB); | |
820 // } | |
821 // _indexStore.doneIndex(); | |
822 // _scope = SearchScopeFactory.createUniverseScope(); | |
823 // // search matches | |
824 // List<SearchMatch> matches = _searchFunctionDeclarationsSync(); | |
825 // // verify | |
826 // _assertMatches(matches, [ | |
827 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.FUNCT
ION_DECLARATION, 1, 2), | |
828 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.FUNCT
ION_DECLARATION, 10, 20)]); | |
829 // } | |
830 // | |
831 // void test_searchFunctionDeclarations_useFilter() { | |
832 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
833 // _defineFunctionsAB(library); | |
834 // _scope = new LibrarySearchScope.con2([library]); | |
835 // // search "elementA" | |
836 // { | |
837 // _filter = new SearchFilter_SearchEngineImplTest_test_searchFunctionDecla
rations_useFilter_2(this); | |
838 // List<SearchMatch> matches = _searchFunctionDeclarationsSync(); | |
839 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_el
ementA, MatchKind.FUNCTION_DECLARATION, 1, 2)]); | |
840 // } | |
841 // // search "elementB" | |
842 // { | |
843 // _filter = new SearchFilter_SearchEngineImplTest_test_searchFunctionDecla
rations_useFilter(this); | |
844 // List<SearchMatch> matches = _searchFunctionDeclarationsSync(); | |
845 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_el
ementB, MatchKind.FUNCTION_DECLARATION, 10, 20)]); | |
846 // } | |
847 // } | |
848 // | |
849 // void test_searchFunctionDeclarations_usePattern() { | |
850 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
851 // _defineFunctionsAB(library); | |
852 // _scope = new LibrarySearchScope.con2([library]); | |
853 // // search "A" | |
854 // { | |
855 // _pattern = SearchPatternFactory.createExactPattern("A", true); | |
856 // List<SearchMatch> matches = _searchFunctionDeclarationsSync(); | |
857 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_el
ementA, MatchKind.FUNCTION_DECLARATION, 1, 2)]); | |
858 // } | |
859 // // search "B" | |
860 // { | |
861 // _pattern = SearchPatternFactory.createExactPattern("B", true); | |
862 // List<SearchMatch> matches = _searchFunctionDeclarationsSync(); | |
863 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_el
ementB, MatchKind.FUNCTION_DECLARATION, 10, 20)]); | |
864 // } | |
865 // } | |
866 // | |
867 // void test_searchReferences_AngularComponentElement() { | |
868 // AngularComponentElement referencedElement = _mockElement(AngularComponentE
lement, ElementKind.ANGULAR_COMPONENT); | |
869 // { | |
870 // Location locationA = new Location(_elementA, 1, 2); | |
871 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationA); | |
872 // } | |
873 // { | |
874 // Location locationB = new Location(_elementB, 10, 20); | |
875 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_CLOSING_TAG_REFERENCE, locationB); | |
876 // } | |
877 // _indexStore.doneIndex(); | |
878 // // search matches | |
879 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
880 // _assertMatches(matches, [ | |
881 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.ANGUL
AR_REFERENCE, 1, 2), | |
882 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.ANGUL
AR_CLOSING_TAG_REFERENCE, 10, 20)]); | |
883 // } | |
884 // | |
885 // void test_searchReferences_AngularControllerElement() { | |
886 // AngularControllerElement referencedElement = _mockElement(AngularControlle
rElement, ElementKind.ANGULAR_CONTROLLER); | |
887 // { | |
888 // Location locationA = new Location(_elementA, 1, 2); | |
889 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationA); | |
890 // } | |
891 // { | |
892 // Location locationB = new Location(_elementB, 10, 20); | |
893 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationB); | |
894 // } | |
895 // _indexStore.doneIndex(); | |
896 // // search matches | |
897 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
898 // _assertMatches(matches, [ | |
899 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.ANGUL
AR_REFERENCE, 1, 2), | |
900 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.ANGUL
AR_REFERENCE, 10, 20)]); | |
901 // } | |
902 // | |
903 // void test_searchReferences_AngularFilterElement() { | |
904 // AngularFormatterElement referencedElement = _mockElement(AngularFormatterE
lement, ElementKind.ANGULAR_FORMATTER); | |
905 // { | |
906 // Location locationA = new Location(_elementA, 1, 2); | |
907 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationA); | |
908 // } | |
909 // { | |
910 // Location locationB = new Location(_elementB, 10, 20); | |
911 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationB); | |
912 // } | |
913 // _indexStore.doneIndex(); | |
914 // // search matches | |
915 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
916 // _assertMatches(matches, [ | |
917 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.ANGUL
AR_REFERENCE, 1, 2), | |
918 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.ANGUL
AR_REFERENCE, 10, 20)]); | |
919 // } | |
920 // | |
921 // void test_searchReferences_AngularPropertyElement() { | |
922 // AngularPropertyElement referencedElement = _mockElement(AngularPropertyEle
ment, ElementKind.ANGULAR_PROPERTY); | |
923 // { | |
924 // Location locationA = new Location(_elementA, 1, 2); | |
925 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationA); | |
926 // } | |
927 // { | |
928 // Location locationB = new Location(_elementB, 10, 20); | |
929 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationB); | |
930 // } | |
931 // _indexStore.doneIndex(); | |
932 // // search matches | |
933 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
934 // _assertMatches(matches, [ | |
935 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.ANGUL
AR_REFERENCE, 1, 2), | |
936 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.ANGUL
AR_REFERENCE, 10, 20)]); | |
937 // } | |
938 // | |
939 // void test_searchReferences_AngularScopePropertyElement() { | |
940 // AngularScopePropertyElement referencedElement = _mockElement(AngularScopeP
ropertyElement, ElementKind.ANGULAR_SCOPE_PROPERTY); | |
941 // { | |
942 // Location locationA = new Location(_elementA, 1, 2); | |
943 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationA); | |
944 // } | |
945 // { | |
946 // Location locationB = new Location(_elementB, 10, 20); | |
947 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationB); | |
948 // } | |
949 // _indexStore.doneIndex(); | |
950 // // search matches | |
951 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
952 // _assertMatches(matches, [ | |
953 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.ANGUL
AR_REFERENCE, 1, 2), | |
954 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.ANGUL
AR_REFERENCE, 10, 20)]); | |
955 // } | |
956 // | |
957 // void test_searchReferences_AngularSelectorElement() { | |
958 // AngularSelectorElement referencedElement = _mockElement(AngularSelectorEle
ment, ElementKind.ANGULAR_SELECTOR); | |
959 // { | |
960 // Location locationA = new Location(_elementA, 1, 2); | |
961 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationA); | |
962 // } | |
963 // { | |
964 // Location locationB = new Location(_elementB, 10, 20); | |
965 // _indexStore.recordRelationship(referencedElement, IndexConstants.ANGULAR
_REFERENCE, locationB); | |
966 // } | |
967 // _indexStore.doneIndex(); | |
968 // // search matches | |
969 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
970 // _assertMatches(matches, [ | |
971 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.ANGUL
AR_REFERENCE, 1, 2), | |
972 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.ANGUL
AR_REFERENCE, 10, 20)]); | |
973 // } | |
974 // | |
975 // void test_searchReferences_ClassElement() { | |
976 // ClassElement referencedElement = _mockElement(ClassElement, ElementKind.CL
ASS); | |
977 // { | |
978 // Location locationA = new Location(_elementA, 1, 2); | |
979 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationA); | |
980 // } | |
981 // { | |
982 // Location locationB = new Location(_elementB, 10, 20); | |
983 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationB); | |
984 // } | |
985 // _indexStore.doneIndex(); | |
986 // // search matches | |
987 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
988 // // verify | |
989 // _assertMatches(matches, [ | |
990 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.TYPE_
REFERENCE, 1, 2), | |
991 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.TYPE_
REFERENCE, 10, 20)]); | |
992 // } | |
993 // | |
994 // void test_searchReferences_ClassElement_useScope() { | |
995 // LibraryElement libraryA = _mockElement(LibraryElement, ElementKind.LIBRARY
); | |
996 // LibraryElement libraryB = _mockElement(LibraryElement, ElementKind.LIBRARY
); | |
997 // ClassElement referencedElement = _mockElement(ClassElement, ElementKind.CL
ASS); | |
998 // { | |
999 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(libraryA); | |
1000 // Location locationA = new Location(_elementA, 1, 2); | |
1001 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationA); | |
1002 // } | |
1003 // { | |
1004 // when(_elementB.getAncestor((element) => element is LibraryElement)).then
Return(libraryB); | |
1005 // Location locationB = new Location(_elementB, 10, 20); | |
1006 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationB); | |
1007 // } | |
1008 // _indexStore.doneIndex(); | |
1009 // // search matches, in "libraryA" | |
1010 // _scope = SearchScopeFactory.createLibraryScope3(libraryA); | |
1011 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1012 // // verify | |
1013 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.TYPE_REFERENCE, 1, 2)]); | |
1014 // } | |
1015 // | |
1016 // void test_searchReferences_CompilationUnitElement() { | |
1017 // CompilationUnitElement referencedElement = _mockElement(CompilationUnitEle
ment, ElementKind.COMPILATION_UNIT); | |
1018 // { | |
1019 // Location location = new Location(_elementA, 1, 2); | |
1020 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, location); | |
1021 // } | |
1022 // _indexStore.doneIndex(); | |
1023 // // search matches | |
1024 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1025 // // verify | |
1026 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.UNIT_REFERENCE, 1, 2)]); | |
1027 // } | |
1028 // | |
1029 // void test_searchReferences_ConstructorElement() { | |
1030 // ConstructorElement referencedElement = _mockElement(ConstructorElement, El
ementKind.CONSTRUCTOR); | |
1031 // { | |
1032 // Location location = new Location(_elementA, 10, 1); | |
1033 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_DEFI
NED_BY, location); | |
1034 // } | |
1035 // { | |
1036 // Location location = new Location(_elementB, 20, 2); | |
1037 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, location); | |
1038 // } | |
1039 // { | |
1040 // Location location = new Location(_elementC, 30, 3); | |
1041 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, location); | |
1042 // } | |
1043 // _indexStore.doneIndex(); | |
1044 // // search matches | |
1045 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1046 // // verify | |
1047 // _assertMatches(matches, [ | |
1048 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.CONST
RUCTOR_DECLARATION, 10, 1), | |
1049 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.CONST
RUCTOR_REFERENCE, 20, 2), | |
1050 // new SearchEngineImplTest_ExpectedMatch.con1(_elementC, MatchKind.CONST
RUCTOR_REFERENCE, 30, 3)]); | |
1051 // } | |
1052 // | |
1053 // void test_searchReferences_Element_unknown() { | |
1054 // List<SearchMatch> matches = _searchReferencesSync(Element, null); | |
1055 // assertThat(matches).isEmpty(); | |
1056 // } | |
1057 // | |
1058 // void test_searchReferences_FieldElement() { | |
1059 // PropertyAccessorElement getterElement = _mockElement(PropertyAccessorEleme
nt, ElementKind.GETTER); | |
1060 // PropertyAccessorElement setterElement = _mockElement(PropertyAccessorEleme
nt, ElementKind.SETTER); | |
1061 // FieldElement fieldElement = _mockElement(FieldElement, ElementKind.FIELD); | |
1062 // when(fieldElement.getter).thenReturn(getterElement); | |
1063 // when(fieldElement.setter).thenReturn(setterElement); | |
1064 // { | |
1065 // Location location = new Location(_elementA, 1, 10); | |
1066 // _indexStore.recordRelationship(getterElement, IndexConstants.IS_REFERENC
ED_BY_UNQUALIFIED, location); | |
1067 // } | |
1068 // { | |
1069 // Location location = new Location(_elementB, 2, 20); | |
1070 // _indexStore.recordRelationship(getterElement, IndexConstants.IS_REFERENC
ED_BY_QUALIFIED, location); | |
1071 // } | |
1072 // { | |
1073 // Location location = new Location(_elementC, 3, 30); | |
1074 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_UNQUALIFIED, location); | |
1075 // } | |
1076 // { | |
1077 // Location location = new Location(_elementD, 4, 40); | |
1078 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_QUALIFIED, location); | |
1079 // } | |
1080 // _indexStore.doneIndex(); | |
1081 // // search matches | |
1082 // List<SearchMatch> matches = _searchReferencesSync(Element, fieldElement); | |
1083 // // verify | |
1084 // _assertMatches(matches, [ | |
1085 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.FIELD
_READ, 1, 10, false), | |
1086 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.FIELD
_READ, 2, 20, true), | |
1087 // new SearchEngineImplTest_ExpectedMatch.con2(_elementC, MatchKind.FIELD
_WRITE, 3, 30, false), | |
1088 // new SearchEngineImplTest_ExpectedMatch.con2(_elementD, MatchKind.FIELD
_WRITE, 4, 40, true)]); | |
1089 // } | |
1090 // | |
1091 // void test_searchReferences_FieldElement_invocation() { | |
1092 // PropertyAccessorElement getterElement = _mockElement(PropertyAccessorEleme
nt, ElementKind.GETTER); | |
1093 // FieldElement fieldElement = _mockElement(FieldElement, ElementKind.FIELD); | |
1094 // when(fieldElement.getter).thenReturn(getterElement); | |
1095 // { | |
1096 // Location location = new Location(_elementA, 1, 10); | |
1097 // _indexStore.recordRelationship(getterElement, IndexConstants.IS_INVOKED_
BY_QUALIFIED, location); | |
1098 // } | |
1099 // { | |
1100 // Location location = new Location(_elementB, 2, 20); | |
1101 // _indexStore.recordRelationship(getterElement, IndexConstants.IS_INVOKED_
BY_UNQUALIFIED, location); | |
1102 // } | |
1103 // _indexStore.doneIndex(); | |
1104 // // search matches | |
1105 // List<SearchMatch> matches = _searchReferencesSync(Element, fieldElement); | |
1106 // // verify | |
1107 // _assertMatches(matches, [ | |
1108 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.FIELD
_INVOCATION, 1, 10, true), | |
1109 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.FIELD
_INVOCATION, 2, 20, false)]); | |
1110 // } | |
1111 // | |
1112 // void test_searchReferences_FieldElement2() { | |
1113 // FieldElement fieldElement = _mockElement(FieldElement, ElementKind.FIELD); | |
1114 // { | |
1115 // Location location = new Location(_elementA, 1, 10); | |
1116 // _indexStore.recordRelationship(fieldElement, IndexConstants.IS_REFERENCE
D_BY, location); | |
1117 // } | |
1118 // { | |
1119 // Location location = new Location(_elementB, 2, 20); | |
1120 // _indexStore.recordRelationship(fieldElement, IndexConstants.IS_REFERENCE
D_BY_QUALIFIED, location); | |
1121 // } | |
1122 // _indexStore.doneIndex(); | |
1123 // // search matches | |
1124 // List<SearchMatch> matches = _searchReferencesSync(Element, fieldElement); | |
1125 // // verify | |
1126 // _assertMatches(matches, [ | |
1127 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.FIELD
_REFERENCE, 1, 10, false), | |
1128 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.FIELD
_REFERENCE, 2, 20, true)]); | |
1129 // } | |
1130 // | |
1131 // void test_searchReferences_FunctionElement() { | |
1132 // FunctionElement referencedElement = _mockElement(FunctionElement, ElementK
ind.FUNCTION); | |
1133 // { | |
1134 // Location location = new Location(_elementA, 1, 10); | |
1135 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY, location); | |
1136 // } | |
1137 // { | |
1138 // Location location = new Location(_elementB, 2, 20); | |
1139 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, location); | |
1140 // } | |
1141 // _indexStore.doneIndex(); | |
1142 // // search matches | |
1143 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1144 // // verify | |
1145 // _assertMatches(matches, [ | |
1146 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.FUNCT
ION_EXECUTION, 1, 10), | |
1147 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.FUNCT
ION_REFERENCE, 2, 20)]); | |
1148 // } | |
1149 // | |
1150 // void test_searchReferences_ImportElement() { | |
1151 // ImportElement referencedElement = _mockElement(ImportElement, ElementKind.
IMPORT); | |
1152 // { | |
1153 // Location locationA = new Location(_elementA, 1, 2); | |
1154 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationA); | |
1155 // } | |
1156 // { | |
1157 // Location locationB = new Location(_elementB, 10, 0); | |
1158 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationB); | |
1159 // } | |
1160 // _indexStore.doneIndex(); | |
1161 // // search matches | |
1162 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1163 // // verify | |
1164 // _assertMatches(matches, [ | |
1165 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.IMPOR
T_REFERENCE, 1, 2), | |
1166 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.IMPOR
T_REFERENCE, 10, 0)]); | |
1167 // } | |
1168 // | |
1169 // void test_searchReferences_LibraryElement() { | |
1170 // LibraryElement referencedElement = _mockElement(LibraryElement, ElementKin
d.LIBRARY); | |
1171 // { | |
1172 // Location location = new Location(_elementA, 1, 2); | |
1173 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, location); | |
1174 // } | |
1175 // _indexStore.doneIndex(); | |
1176 // // search matches | |
1177 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1178 // // verify | |
1179 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.LIBRARY_REFERENCE, 1, 2)]); | |
1180 // } | |
1181 // | |
1182 // void test_searchReferences_MethodElement() { | |
1183 // MethodElement referencedElement = _mockElement(MethodElement, ElementKind.
METHOD); | |
1184 // { | |
1185 // Location location = new Location(_elementA, 1, 10); | |
1186 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY_UNQUALIFIED, location); | |
1187 // } | |
1188 // { | |
1189 // Location location = new Location(_elementB, 2, 20); | |
1190 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY_QUALIFIED, location); | |
1191 // } | |
1192 // { | |
1193 // Location location = new Location(_elementC, 3, 30); | |
1194 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY_UNQUALIFIED, location); | |
1195 // } | |
1196 // { | |
1197 // Location location = new Location(_elementD, 4, 40); | |
1198 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY_QUALIFIED, location); | |
1199 // } | |
1200 // _indexStore.doneIndex(); | |
1201 // // search matches | |
1202 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1203 // // verify | |
1204 // _assertMatches(matches, [ | |
1205 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.METHO
D_INVOCATION, 1, 10, false), | |
1206 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.METHO
D_INVOCATION, 2, 20, true), | |
1207 // new SearchEngineImplTest_ExpectedMatch.con2(_elementC, MatchKind.METHO
D_REFERENCE, 3, 30, false), | |
1208 // new SearchEngineImplTest_ExpectedMatch.con2(_elementD, MatchKind.METHO
D_REFERENCE, 4, 40, true)]); | |
1209 // } | |
1210 // | |
1211 // void test_searchReferences_MethodMember() { | |
1212 // MethodElement referencedElement = _mockElement(MethodElement, ElementKind.
METHOD); | |
1213 // { | |
1214 // Location location = new Location(_elementA, 1, 10); | |
1215 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY_UNQUALIFIED, location); | |
1216 // } | |
1217 // { | |
1218 // Location location = new Location(_elementB, 2, 20); | |
1219 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY_QUALIFIED, location); | |
1220 // } | |
1221 // { | |
1222 // Location location = new Location(_elementC, 3, 30); | |
1223 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY_UNQUALIFIED, location); | |
1224 // } | |
1225 // { | |
1226 // Location location = new Location(_elementD, 4, 40); | |
1227 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY_QUALIFIED, location); | |
1228 // } | |
1229 // _indexStore.doneIndex(); | |
1230 // // search matches | |
1231 // MethodMember referencedMember = new MethodMember(referencedElement, null); | |
1232 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedMembe
r); | |
1233 // // verify | |
1234 // _assertMatches(matches, [ | |
1235 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.METHO
D_INVOCATION, 1, 10, false), | |
1236 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.METHO
D_INVOCATION, 2, 20, true), | |
1237 // new SearchEngineImplTest_ExpectedMatch.con2(_elementC, MatchKind.METHO
D_REFERENCE, 3, 30, false), | |
1238 // new SearchEngineImplTest_ExpectedMatch.con2(_elementD, MatchKind.METHO
D_REFERENCE, 4, 40, true)]); | |
1239 // } | |
1240 // | |
1241 // void test_searchReferences_notSupported() { | |
1242 // Element referencedElement = _mockElement(Element, ElementKind.UNIVERSE); | |
1243 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1244 // assertThat(matches).isEmpty(); | |
1245 // } | |
1246 // | |
1247 // void test_searchReferences_ParameterElement() { | |
1248 // ParameterElement referencedElement = _mockElement(ParameterElement, Elemen
tKind.PARAMETER); | |
1249 // { | |
1250 // Location location = new Location(_elementA, 1, 10); | |
1251 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_READ
_BY, location); | |
1252 // } | |
1253 // { | |
1254 // Location location = new Location(_elementB, 2, 20); | |
1255 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_WRIT
TEN_BY, location); | |
1256 // } | |
1257 // { | |
1258 // Location location = new Location(_elementC, 3, 30); | |
1259 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_READ
_WRITTEN_BY, location); | |
1260 // } | |
1261 // { | |
1262 // Location location = new Location(_elementD, 4, 40); | |
1263 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, location); | |
1264 // } | |
1265 // { | |
1266 // Location location = new Location(_elementD, 5, 50); | |
1267 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY, location); | |
1268 // } | |
1269 // _indexStore.doneIndex(); | |
1270 // // search matches | |
1271 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1272 // // verify | |
1273 // // TODO(scheglov) why no MatchKind.FIELD_READ_WRITE ? | |
1274 // _assertMatches(matches, [ | |
1275 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.VARIA
BLE_READ, 1, 10), | |
1276 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.VARIA
BLE_WRITE, 2, 20), | |
1277 // new SearchEngineImplTest_ExpectedMatch.con1(_elementC, MatchKind.VARIA
BLE_READ_WRITE, 3, 30), | |
1278 // new SearchEngineImplTest_ExpectedMatch.con1(_elementD, MatchKind.NAMED
_PARAMETER_REFERENCE, 4, 40), | |
1279 // new SearchEngineImplTest_ExpectedMatch.con1(_elementD, MatchKind.FUNCT
ION_EXECUTION, 5, 50)]); | |
1280 // } | |
1281 // | |
1282 // void test_searchReferences_PropertyAccessorElement_getter() { | |
1283 // PropertyAccessorElement accessor = _mockElement(PropertyAccessorElement, E
lementKind.GETTER); | |
1284 // { | |
1285 // Location location = new Location(_elementA, 1, 10); | |
1286 // _indexStore.recordRelationship(accessor, IndexConstants.IS_REFERENCED_BY
_UNQUALIFIED, location); | |
1287 // } | |
1288 // { | |
1289 // Location location = new Location(_elementB, 2, 20); | |
1290 // _indexStore.recordRelationship(accessor, IndexConstants.IS_REFERENCED_BY
_QUALIFIED, location); | |
1291 // } | |
1292 // _indexStore.doneIndex(); | |
1293 // // search matches | |
1294 // List<SearchMatch> matches = _searchReferencesSync(Element, accessor); | |
1295 // // verify | |
1296 // _assertMatches(matches, [ | |
1297 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.PROPE
RTY_ACCESSOR_REFERENCE, 1, 10, false), | |
1298 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.PROPE
RTY_ACCESSOR_REFERENCE, 2, 20, true)]); | |
1299 // } | |
1300 // | |
1301 // void test_searchReferences_PropertyAccessorElement_setter() { | |
1302 // PropertyAccessorElement accessor = _mockElement(PropertyAccessorElement, E
lementKind.SETTER); | |
1303 // { | |
1304 // Location location = new Location(_elementA, 1, 10); | |
1305 // _indexStore.recordRelationship(accessor, IndexConstants.IS_REFERENCED_BY
_UNQUALIFIED, location); | |
1306 // } | |
1307 // { | |
1308 // Location location = new Location(_elementB, 2, 20); | |
1309 // _indexStore.recordRelationship(accessor, IndexConstants.IS_REFERENCED_BY
_QUALIFIED, location); | |
1310 // } | |
1311 // _indexStore.doneIndex(); | |
1312 // // search matches | |
1313 // List<SearchMatch> matches = _searchReferencesSync(Element, accessor); | |
1314 // // verify | |
1315 // _assertMatches(matches, [ | |
1316 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.PROPE
RTY_ACCESSOR_REFERENCE, 1, 10, false), | |
1317 // new SearchEngineImplTest_ExpectedMatch.con2(_elementB, MatchKind.PROPE
RTY_ACCESSOR_REFERENCE, 2, 20, true)]); | |
1318 // } | |
1319 // | |
1320 // void test_searchReferences_TopLevelVariableElement() { | |
1321 // PropertyAccessorElement getterElement = _mockElement(PropertyAccessorEleme
nt, ElementKind.GETTER); | |
1322 // PropertyAccessorElement setterElement = _mockElement(PropertyAccessorEleme
nt, ElementKind.SETTER); | |
1323 // TopLevelVariableElement topVariableElement = _mockElement(TopLevelVariable
Element, ElementKind.TOP_LEVEL_VARIABLE); | |
1324 // when(topVariableElement.getter).thenReturn(getterElement); | |
1325 // when(topVariableElement.setter).thenReturn(setterElement); | |
1326 // { | |
1327 // Location location = new Location(_elementA, 1, 10); | |
1328 // _indexStore.recordRelationship(getterElement, IndexConstants.IS_REFERENC
ED_BY_UNQUALIFIED, location); | |
1329 // } | |
1330 // { | |
1331 // Location location = new Location(_elementC, 2, 20); | |
1332 // _indexStore.recordRelationship(setterElement, IndexConstants.IS_REFERENC
ED_BY_UNQUALIFIED, location); | |
1333 // } | |
1334 // _indexStore.doneIndex(); | |
1335 // // search matches | |
1336 // List<SearchMatch> matches = _searchReferencesSync(Element, topVariableElem
ent); | |
1337 // // verify | |
1338 // _assertMatches(matches, [ | |
1339 // new SearchEngineImplTest_ExpectedMatch.con2(_elementA, MatchKind.FIELD
_READ, 1, 10, false), | |
1340 // new SearchEngineImplTest_ExpectedMatch.con2(_elementC, MatchKind.FIELD
_WRITE, 2, 20, false)]); | |
1341 // } | |
1342 // | |
1343 // void test_searchReferences_TypeAliasElement() { | |
1344 // FunctionTypeAliasElement referencedElement = _mockElement(FunctionTypeAlia
sElement, ElementKind.FUNCTION_TYPE_ALIAS); | |
1345 // { | |
1346 // Location locationA = new Location(_elementA, 1, 2); | |
1347 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationA); | |
1348 // } | |
1349 // { | |
1350 // Location locationB = new Location(_elementB, 10, 20); | |
1351 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationB); | |
1352 // } | |
1353 // _indexStore.doneIndex(); | |
1354 // // search matches | |
1355 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1356 // // verify | |
1357 // _assertMatches(matches, [ | |
1358 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.FUNCT
ION_TYPE_REFERENCE, 1, 2), | |
1359 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.FUNCT
ION_TYPE_REFERENCE, 10, 20)]); | |
1360 // } | |
1361 // | |
1362 // void test_searchReferences_TypeParameterElement() { | |
1363 // TypeParameterElement referencedElement = _mockElement(TypeParameterElement
, ElementKind.TYPE_PARAMETER); | |
1364 // { | |
1365 // Location locationA = new Location(_elementA, 1, 2); | |
1366 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationA); | |
1367 // } | |
1368 // { | |
1369 // Location locationB = new Location(_elementB, 10, 20); | |
1370 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY, locationB); | |
1371 // } | |
1372 // _indexStore.doneIndex(); | |
1373 // // search matches | |
1374 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1375 // // verify | |
1376 // _assertMatches(matches, [ | |
1377 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.TYPE_
PARAMETER_REFERENCE, 1, 2), | |
1378 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.TYPE_
PARAMETER_REFERENCE, 10, 20)]); | |
1379 // } | |
1380 // | |
1381 // void test_searchReferences_VariableElement() { | |
1382 // LocalVariableElement referencedElement = _mockElement(LocalVariableElement
, ElementKind.LOCAL_VARIABLE); | |
1383 // { | |
1384 // Location location = new Location(_elementA, 1, 10); | |
1385 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_READ
_BY, location); | |
1386 // } | |
1387 // { | |
1388 // Location location = new Location(_elementB, 2, 20); | |
1389 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_WRIT
TEN_BY, location); | |
1390 // } | |
1391 // { | |
1392 // Location location = new Location(_elementC, 3, 30); | |
1393 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_READ
_WRITTEN_BY, location); | |
1394 // } | |
1395 // { | |
1396 // Location location = new Location(_elementD, 4, 40); | |
1397 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_INVO
KED_BY, location); | |
1398 // } | |
1399 // _indexStore.doneIndex(); | |
1400 // // search matches | |
1401 // List<SearchMatch> matches = _searchReferencesSync(Element, referencedEleme
nt); | |
1402 // // verify | |
1403 // _assertMatches(matches, [ | |
1404 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.VARIA
BLE_READ, 1, 10), | |
1405 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.VARIA
BLE_WRITE, 2, 20), | |
1406 // new SearchEngineImplTest_ExpectedMatch.con1(_elementC, MatchKind.VARIA
BLE_READ_WRITE, 3, 30), | |
1407 // new SearchEngineImplTest_ExpectedMatch.con1(_elementD, MatchKind.FUNCT
ION_EXECUTION, 4, 40)]); | |
1408 // } | |
1409 // | |
1410 // void test_searchSubtypes() { | |
1411 // ClassElement referencedElement = _mockElement(ClassElement, ElementKind.CL
ASS); | |
1412 // { | |
1413 // Location locationA = new Location(_elementA, 10, 1); | |
1414 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_EXTE
NDED_BY, locationA); | |
1415 // } | |
1416 // { | |
1417 // Location locationB = new Location(_elementB, 20, 2); | |
1418 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_MIXE
D_IN_BY, locationB); | |
1419 // } | |
1420 // { | |
1421 // Location locationC = new Location(_elementC, 30, 3); | |
1422 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_IMPL
EMENTED_BY, locationC); | |
1423 // } | |
1424 // _indexStore.doneIndex(); | |
1425 // // search matches | |
1426 // List<SearchMatch> matches = _runSearch(new SearchRunner_SearchEngineImplTe
st_test_searchSubtypes(this, referencedElement)); | |
1427 // // verify | |
1428 // _assertMatches(matches, [ | |
1429 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.EXTEN
DS_REFERENCE, 10, 1), | |
1430 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.WITH_
REFERENCE, 20, 2), | |
1431 // new SearchEngineImplTest_ExpectedMatch.con1(_elementC, MatchKind.IMPLE
MENTS_REFERENCE, 30, 3)]); | |
1432 // } | |
1433 // | |
1434 // void test_searchTypeDeclarations_async() { | |
1435 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1436 // { | |
1437 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1438 // Location locationA = new Location(_elementA, 1, 2); | |
1439 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_CLASS, lo
cationA); | |
1440 // } | |
1441 // _indexStore.doneIndex(); | |
1442 // _scope = new LibrarySearchScope.con2([library]); | |
1443 // // search matches | |
1444 // List<SearchMatch> matches = _searchTypeDeclarationsAsync(); | |
1445 // // verify | |
1446 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.CLASS_DECLARATION, 1, 2)]); | |
1447 // } | |
1448 // | |
1449 // void test_searchTypeDeclarations_class() { | |
1450 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1451 // { | |
1452 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1453 // Location locationA = new Location(_elementA, 1, 2); | |
1454 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_CLASS, lo
cationA); | |
1455 // } | |
1456 // _indexStore.doneIndex(); | |
1457 // _scope = new LibrarySearchScope.con2([library]); | |
1458 // // search matches | |
1459 // List<SearchMatch> matches = _searchTypeDeclarationsSync(); | |
1460 // // verify | |
1461 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.CLASS_DECLARATION, 1, 2)]); | |
1462 // } | |
1463 // | |
1464 // void test_searchTypeDeclarations_classAlias() { | |
1465 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1466 // { | |
1467 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1468 // Location locationA = new Location(_elementA, 1, 2); | |
1469 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_CLASS_ALI
AS, locationA); | |
1470 // } | |
1471 // _indexStore.doneIndex(); | |
1472 // _scope = new LibrarySearchScope.con2([library]); | |
1473 // // search matches | |
1474 // List<SearchMatch> matches = _searchTypeDeclarationsSync(); | |
1475 // // verify | |
1476 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.CLASS_ALIAS_DECLARATION, 1, 2)]); | |
1477 // } | |
1478 // | |
1479 // void test_searchTypeDeclarations_functionType() { | |
1480 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1481 // { | |
1482 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1483 // Location locationA = new Location(_elementA, 1, 2); | |
1484 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION_
TYPE, locationA); | |
1485 // } | |
1486 // _indexStore.doneIndex(); | |
1487 // _scope = new LibrarySearchScope.con2([library]); | |
1488 // // search matches | |
1489 // List<SearchMatch> matches = _searchTypeDeclarationsSync(); | |
1490 // // verify | |
1491 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_elem
entA, MatchKind.FUNCTION_TYPE_DECLARATION, 1, 2)]); | |
1492 // } | |
1493 // | |
1494 // void test_searchUnresolvedQualifiedReferences() { | |
1495 // Element referencedElement = new NameElementImpl("test"); | |
1496 // { | |
1497 // Location locationA = new Location(_elementA, 1, 2); | |
1498 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY_QUALIFIED_RESOLVED, locationA); | |
1499 // } | |
1500 // { | |
1501 // Location locationB = new Location(_elementB, 10, 20); | |
1502 // _indexStore.recordRelationship(referencedElement, IndexConstants.IS_REFE
RENCED_BY_QUALIFIED_UNRESOLVED, locationB); | |
1503 // } | |
1504 // _indexStore.doneIndex(); | |
1505 // // search matches | |
1506 // List<SearchMatch> matches = _searchReferencesSync2("searchQualifiedMemberR
eferences", String, "test"); | |
1507 // // verify | |
1508 // _assertMatches(matches, [ | |
1509 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.NAME_
REFERENCE_RESOLVED, 1, 2), | |
1510 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.NAME_
REFERENCE_UNRESOLVED, 10, 20)]); | |
1511 // } | |
1512 // | |
1513 // void test_searchVariableDeclarations() { | |
1514 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1515 // _defineVariablesAB(library); | |
1516 // _scope = new LibrarySearchScope.con2([library]); | |
1517 // // search matches | |
1518 // List<SearchMatch> matches = _searchVariableDeclarationsSync(); | |
1519 // // verify | |
1520 // _assertMatches(matches, [ | |
1521 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.VARIA
BLE_DECLARATION, 1, 2), | |
1522 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.VARIA
BLE_DECLARATION, 10, 20)]); | |
1523 // } | |
1524 // | |
1525 // void test_searchVariableDeclarations_async() { | |
1526 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1527 // _defineVariablesAB(library); | |
1528 // _scope = new LibrarySearchScope.con2([library]); | |
1529 // // search matches | |
1530 // List<SearchMatch> matches = _searchVariableDeclarationsAsync(); | |
1531 // // verify | |
1532 // _assertMatches(matches, [ | |
1533 // new SearchEngineImplTest_ExpectedMatch.con1(_elementA, MatchKind.VARIA
BLE_DECLARATION, 1, 2), | |
1534 // new SearchEngineImplTest_ExpectedMatch.con1(_elementB, MatchKind.VARIA
BLE_DECLARATION, 10, 20)]); | |
1535 // } | |
1536 // | |
1537 // void test_searchVariableDeclarations_usePattern() { | |
1538 // LibraryElement library = _mockElement(LibraryElement, ElementKind.LIBRARY)
; | |
1539 // _defineVariablesAB(library); | |
1540 // _scope = new LibrarySearchScope.con2([library]); | |
1541 // // search "A" | |
1542 // { | |
1543 // _pattern = SearchPatternFactory.createExactPattern("A", true); | |
1544 // List<SearchMatch> matches = _searchVariableDeclarationsSync(); | |
1545 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_el
ementA, MatchKind.VARIABLE_DECLARATION, 1, 2)]); | |
1546 // } | |
1547 // // search "B" | |
1548 // { | |
1549 // _pattern = SearchPatternFactory.createExactPattern("B", true); | |
1550 // List<SearchMatch> matches = _searchVariableDeclarationsSync(); | |
1551 // _assertMatches(matches, [new SearchEngineImplTest_ExpectedMatch.con1(_el
ementB, MatchKind.VARIABLE_DECLARATION, 10, 20)]); | |
1552 // } | |
1553 // } | |
1554 // | |
1555 // @override | |
1556 // void setUp() { | |
1557 // super.setUp(); | |
1558 // // library | |
1559 // when(_unitElement.library).thenReturn(_libraryElement); | |
1560 // when(_libraryElement.definingCompilationUnit).thenReturn(_unitElement); | |
1561 // when(_unitElement.source).thenReturn(_source); | |
1562 // when(_libraryElement.source).thenReturn(_source); | |
1563 // when(_libraryElement.parts).thenReturn(new List<CompilationUnitElement>(0)
); | |
1564 // // elements | |
1565 // when(_elementA.toString()).thenReturn("A"); | |
1566 // when(_elementB.toString()).thenReturn("B"); | |
1567 // when(_elementC.toString()).thenReturn("C"); | |
1568 // when(_elementD.toString()).thenReturn("D"); | |
1569 // when(_elementE.toString()).thenReturn("E"); | |
1570 // when(_elementA.displayName).thenReturn("A"); | |
1571 // when(_elementB.displayName).thenReturn("B"); | |
1572 // when(_elementC.displayName).thenReturn("C"); | |
1573 // when(_elementD.displayName).thenReturn("D"); | |
1574 // when(_elementE.displayName).thenReturn("E"); | |
1575 // when(_elementA.source).thenReturn(_source); | |
1576 // when(_elementB.source).thenReturn(_source); | |
1577 // when(_elementC.source).thenReturn(_source); | |
1578 // when(_elementD.source).thenReturn(_source); | |
1579 // when(_elementE.source).thenReturn(_source); | |
1580 // when(_elementA.context).thenReturn(_CONTEXT); | |
1581 // when(_elementB.context).thenReturn(_CONTEXT); | |
1582 // when(_elementC.context).thenReturn(_CONTEXT); | |
1583 // when(_elementD.context).thenReturn(_CONTEXT); | |
1584 // when(_elementE.context).thenReturn(_CONTEXT); | |
1585 // when(_CONTEXT.getElement(_elementA.location)).thenReturn(_elementA); | |
1586 // when(_CONTEXT.getElement(_elementB.location)).thenReturn(_elementB); | |
1587 // when(_CONTEXT.getElement(_elementC.location)).thenReturn(_elementC); | |
1588 // when(_CONTEXT.getElement(_elementD.location)).thenReturn(_elementD); | |
1589 // when(_CONTEXT.getElement(_elementE.location)).thenReturn(_elementE); | |
1590 // // start indexing | |
1591 // JUnitTestCase.assertTrue(_indexStore.aboutToIndexDart(_CONTEXT, _unitEleme
nt)); | |
1592 // } | |
1593 // | |
1594 // void _defineFunctionsAB(LibraryElement library) { | |
1595 // { | |
1596 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1597 // Location locationA = new Location(_elementA, 1, 2); | |
1598 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION,
locationA); | |
1599 // } | |
1600 // { | |
1601 // when(_elementB.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1602 // Location locationB = new Location(_elementB, 10, 20); | |
1603 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION,
locationB); | |
1604 // } | |
1605 // _indexStore.doneIndex(); | |
1606 // } | |
1607 // | |
1608 // void _defineVariablesAB(LibraryElement library) { | |
1609 // { | |
1610 // when(_elementA.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1611 // Location locationA = new Location(_elementA, 1, 2); | |
1612 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_VARIABLE,
locationA); | |
1613 // } | |
1614 // { | |
1615 // when(_elementB.getAncestor((element) => element is LibraryElement)).then
Return(library); | |
1616 // Location locationB = new Location(_elementB, 10, 20); | |
1617 // _indexStore.recordRelationship(library, IndexConstants.DEFINES_VARIABLE,
locationB); | |
1618 // } | |
1619 // _indexStore.doneIndex(); | |
1620 // } | |
1621 // | |
1622 // Element _mockElement(Type clazz, ElementKind kind) { | |
1623 // Element element = mock(clazz); | |
1624 // when(element.context).thenReturn(_CONTEXT); | |
1625 // when(element.source).thenReturn(_source); | |
1626 // when(element.kind).thenReturn(kind); | |
1627 // ElementLocation elementLocation = new ElementLocationImpl.con2("mockLocati
on${_nextLocationId++}"); | |
1628 // when(element.location).thenReturn(elementLocation); | |
1629 // when(_CONTEXT.getElement(element.location)).thenReturn(element); | |
1630 // return element; | |
1631 // } | |
1632 // | |
1633 // Object _runSearch(SearchEngineImplTest_SearchRunner runner) { | |
1634 // OperationQueue queue = new OperationQueue(); | |
1635 // OperationProcessor processor = new OperationProcessor(queue); | |
1636 // Index index = new IndexImpl(_indexStore, queue, processor); | |
1637 // SearchEngine engine = SearchEngineFactory.createSearchEngine(index); | |
1638 // try { | |
1639 // new Thread_SearchEngineImplTest_runSearch(processor).start(); | |
1640 // processor.waitForRunning(); | |
1641 // return runner.run(queue, processor, index, engine); | |
1642 // } finally { | |
1643 // processor.stop(false); | |
1644 // } | |
1645 // } | |
1646 // | |
1647 // List<SearchMatch> _searchDeclarationsAsync(String methodName) => _runSearch(
new SearchRunner_SearchEngineImplTest_searchDeclarationsAsync(this, methodName,
this, matches, latch)); | |
1648 // | |
1649 // List<SearchMatch> _searchDeclarationsSync(String methodName) => _runSearch(n
ew SearchRunner_SearchEngineImplTest_searchDeclarationsSync(this, methodName)); | |
1650 // | |
1651 // List<SearchMatch> _searchFunctionDeclarationsAsync() => _searchDeclarationsA
sync("searchFunctionDeclarations"); | |
1652 // | |
1653 // List<SearchMatch> _searchFunctionDeclarationsSync() => _searchDeclarationsSy
nc("searchFunctionDeclarations"); | |
1654 // | |
1655 // List<SearchMatch> _searchReferencesSync(Type clazz, Object element) => _sear
chReferencesSync2("searchReferences", clazz, element); | |
1656 // | |
1657 // List<SearchMatch> _searchReferencesSync2(String methodName, Type clazz, Obje
ct element) => _runSearch(new SearchRunner_SearchEngineImplTest_searchReferences
Sync(this, methodName, clazz, element)); | |
1658 // | |
1659 // List<SearchMatch> _searchTypeDeclarationsAsync() => _searchDeclarationsAsync
("searchTypeDeclarations"); | |
1660 // | |
1661 // List<SearchMatch> _searchTypeDeclarationsSync() => _searchDeclarationsSync("
searchTypeDeclarations"); | |
1662 // | |
1663 // List<SearchMatch> _searchVariableDeclarationsAsync() => _searchDeclarationsA
sync("searchVariableDeclarations"); | |
1664 // | |
1665 // List<SearchMatch> _searchVariableDeclarationsSync() => _searchDeclarationsSy
nc("searchVariableDeclarations"); | |
1666 // | |
1667 // static dartSuite() { | |
1668 // _ut.group('SearchEngineImplTest', () { | |
1669 // _ut.test('test_searchDeclarations_String', () { | |
1670 // final __test = new SearchEngineImplTest(); | |
1671 // runJUnitTest(__test, __test.test_searchDeclarations_String); | |
1672 // }); | |
1673 // _ut.test('test_searchFunctionDeclarations', () { | |
1674 // final __test = new SearchEngineImplTest(); | |
1675 // runJUnitTest(__test, __test.test_searchFunctionDeclarations); | |
1676 // }); | |
1677 // _ut.test('test_searchFunctionDeclarations_async', () { | |
1678 // final __test = new SearchEngineImplTest(); | |
1679 // runJUnitTest(__test, __test.test_searchFunctionDeclarations_async); | |
1680 // }); | |
1681 // _ut.test('test_searchFunctionDeclarations_inUniverse', () { | |
1682 // final __test = new SearchEngineImplTest(); | |
1683 // runJUnitTest(__test, __test.test_searchFunctionDeclarations_inUniverse
); | |
1684 // }); | |
1685 // _ut.test('test_searchFunctionDeclarations_useFilter', () { | |
1686 // final __test = new SearchEngineImplTest(); | |
1687 // runJUnitTest(__test, __test.test_searchFunctionDeclarations_useFilter)
; | |
1688 // }); | |
1689 // _ut.test('test_searchFunctionDeclarations_usePattern', () { | |
1690 // final __test = new SearchEngineImplTest(); | |
1691 // runJUnitTest(__test, __test.test_searchFunctionDeclarations_usePattern
); | |
1692 // }); | |
1693 // _ut.test('test_searchReferences_AngularComponentElement', () { | |
1694 // final __test = new SearchEngineImplTest(); | |
1695 // runJUnitTest(__test, __test.test_searchReferences_AngularComponentElem
ent); | |
1696 // }); | |
1697 // _ut.test('test_searchReferences_AngularControllerElement', () { | |
1698 // final __test = new SearchEngineImplTest(); | |
1699 // runJUnitTest(__test, __test.test_searchReferences_AngularControllerEle
ment); | |
1700 // }); | |
1701 // _ut.test('test_searchReferences_AngularFilterElement', () { | |
1702 // final __test = new SearchEngineImplTest(); | |
1703 // runJUnitTest(__test, __test.test_searchReferences_AngularFilterElement
); | |
1704 // }); | |
1705 // _ut.test('test_searchReferences_AngularPropertyElement', () { | |
1706 // final __test = new SearchEngineImplTest(); | |
1707 // runJUnitTest(__test, __test.test_searchReferences_AngularPropertyEleme
nt); | |
1708 // }); | |
1709 // _ut.test('test_searchReferences_AngularScopePropertyElement', () { | |
1710 // final __test = new SearchEngineImplTest(); | |
1711 // runJUnitTest(__test, __test.test_searchReferences_AngularScopeProperty
Element); | |
1712 // }); | |
1713 // _ut.test('test_searchReferences_AngularSelectorElement', () { | |
1714 // final __test = new SearchEngineImplTest(); | |
1715 // runJUnitTest(__test, __test.test_searchReferences_AngularSelectorEleme
nt); | |
1716 // }); | |
1717 // _ut.test('test_searchReferences_ClassElement', () { | |
1718 // final __test = new SearchEngineImplTest(); | |
1719 // runJUnitTest(__test, __test.test_searchReferences_ClassElement); | |
1720 // }); | |
1721 // _ut.test('test_searchReferences_ClassElement_useScope', () { | |
1722 // final __test = new SearchEngineImplTest(); | |
1723 // runJUnitTest(__test, __test.test_searchReferences_ClassElement_useScop
e); | |
1724 // }); | |
1725 // _ut.test('test_searchReferences_CompilationUnitElement', () { | |
1726 // final __test = new SearchEngineImplTest(); | |
1727 // runJUnitTest(__test, __test.test_searchReferences_CompilationUnitEleme
nt); | |
1728 // }); | |
1729 // _ut.test('test_searchReferences_ConstructorElement', () { | |
1730 // final __test = new SearchEngineImplTest(); | |
1731 // runJUnitTest(__test, __test.test_searchReferences_ConstructorElement); | |
1732 // }); | |
1733 // _ut.test('test_searchReferences_Element_unknown', () { | |
1734 // final __test = new SearchEngineImplTest(); | |
1735 // runJUnitTest(__test, __test.test_searchReferences_Element_unknown); | |
1736 // }); | |
1737 // _ut.test('test_searchReferences_FieldElement', () { | |
1738 // final __test = new SearchEngineImplTest(); | |
1739 // runJUnitTest(__test, __test.test_searchReferences_FieldElement); | |
1740 // }); | |
1741 // _ut.test('test_searchReferences_FieldElement2', () { | |
1742 // final __test = new SearchEngineImplTest(); | |
1743 // runJUnitTest(__test, __test.test_searchReferences_FieldElement2); | |
1744 // }); | |
1745 // _ut.test('test_searchReferences_FieldElement_invocation', () { | |
1746 // final __test = new SearchEngineImplTest(); | |
1747 // runJUnitTest(__test, __test.test_searchReferences_FieldElement_invocat
ion); | |
1748 // }); | |
1749 // _ut.test('test_searchReferences_FunctionElement', () { | |
1750 // final __test = new SearchEngineImplTest(); | |
1751 // runJUnitTest(__test, __test.test_searchReferences_FunctionElement); | |
1752 // }); | |
1753 // _ut.test('test_searchReferences_ImportElement', () { | |
1754 // final __test = new SearchEngineImplTest(); | |
1755 // runJUnitTest(__test, __test.test_searchReferences_ImportElement); | |
1756 // }); | |
1757 // _ut.test('test_searchReferences_LibraryElement', () { | |
1758 // final __test = new SearchEngineImplTest(); | |
1759 // runJUnitTest(__test, __test.test_searchReferences_LibraryElement); | |
1760 // }); | |
1761 // _ut.test('test_searchReferences_MethodElement', () { | |
1762 // final __test = new SearchEngineImplTest(); | |
1763 // runJUnitTest(__test, __test.test_searchReferences_MethodElement); | |
1764 // }); | |
1765 // _ut.test('test_searchReferences_MethodMember', () { | |
1766 // final __test = new SearchEngineImplTest(); | |
1767 // runJUnitTest(__test, __test.test_searchReferences_MethodMember); | |
1768 // }); | |
1769 // _ut.test('test_searchReferences_ParameterElement', () { | |
1770 // final __test = new SearchEngineImplTest(); | |
1771 // runJUnitTest(__test, __test.test_searchReferences_ParameterElement); | |
1772 // }); | |
1773 // _ut.test('test_searchReferences_PropertyAccessorElement_getter', () { | |
1774 // final __test = new SearchEngineImplTest(); | |
1775 // runJUnitTest(__test, __test.test_searchReferences_PropertyAccessorElem
ent_getter); | |
1776 // }); | |
1777 // _ut.test('test_searchReferences_PropertyAccessorElement_setter', () { | |
1778 // final __test = new SearchEngineImplTest(); | |
1779 // runJUnitTest(__test, __test.test_searchReferences_PropertyAccessorElem
ent_setter); | |
1780 // }); | |
1781 // _ut.test('test_searchReferences_TopLevelVariableElement', () { | |
1782 // final __test = new SearchEngineImplTest(); | |
1783 // runJUnitTest(__test, __test.test_searchReferences_TopLevelVariableElem
ent); | |
1784 // }); | |
1785 // _ut.test('test_searchReferences_TypeAliasElement', () { | |
1786 // final __test = new SearchEngineImplTest(); | |
1787 // runJUnitTest(__test, __test.test_searchReferences_TypeAliasElement); | |
1788 // }); | |
1789 // _ut.test('test_searchReferences_TypeParameterElement', () { | |
1790 // final __test = new SearchEngineImplTest(); | |
1791 // runJUnitTest(__test, __test.test_searchReferences_TypeParameterElement
); | |
1792 // }); | |
1793 // _ut.test('test_searchReferences_VariableElement', () { | |
1794 // final __test = new SearchEngineImplTest(); | |
1795 // runJUnitTest(__test, __test.test_searchReferences_VariableElement); | |
1796 // }); | |
1797 // _ut.test('test_searchReferences_notSupported', () { | |
1798 // final __test = new SearchEngineImplTest(); | |
1799 // runJUnitTest(__test, __test.test_searchReferences_notSupported); | |
1800 // }); | |
1801 // _ut.test('test_searchSubtypes', () { | |
1802 // final __test = new SearchEngineImplTest(); | |
1803 // runJUnitTest(__test, __test.test_searchSubtypes); | |
1804 // }); | |
1805 // _ut.test('test_searchTypeDeclarations_async', () { | |
1806 // final __test = new SearchEngineImplTest(); | |
1807 // runJUnitTest(__test, __test.test_searchTypeDeclarations_async); | |
1808 // }); | |
1809 // _ut.test('test_searchTypeDeclarations_class', () { | |
1810 // final __test = new SearchEngineImplTest(); | |
1811 // runJUnitTest(__test, __test.test_searchTypeDeclarations_class); | |
1812 // }); | |
1813 // _ut.test('test_searchTypeDeclarations_classAlias', () { | |
1814 // final __test = new SearchEngineImplTest(); | |
1815 // runJUnitTest(__test, __test.test_searchTypeDeclarations_classAlias); | |
1816 // }); | |
1817 // _ut.test('test_searchTypeDeclarations_functionType', () { | |
1818 // final __test = new SearchEngineImplTest(); | |
1819 // runJUnitTest(__test, __test.test_searchTypeDeclarations_functionType); | |
1820 // }); | |
1821 // _ut.test('test_searchUnresolvedQualifiedReferences', () { | |
1822 // final __test = new SearchEngineImplTest(); | |
1823 // runJUnitTest(__test, __test.test_searchUnresolvedQualifiedReferences); | |
1824 // }); | |
1825 // _ut.test('test_searchVariableDeclarations', () { | |
1826 // final __test = new SearchEngineImplTest(); | |
1827 // runJUnitTest(__test, __test.test_searchVariableDeclarations); | |
1828 // }); | |
1829 // _ut.test('test_searchVariableDeclarations_async', () { | |
1830 // final __test = new SearchEngineImplTest(); | |
1831 // runJUnitTest(__test, __test.test_searchVariableDeclarations_async); | |
1832 // }); | |
1833 // _ut.test('test_searchVariableDeclarations_usePattern', () { | |
1834 // final __test = new SearchEngineImplTest(); | |
1835 // runJUnitTest(__test, __test.test_searchVariableDeclarations_usePattern
); | |
1836 // }); | |
1837 // }); | |
1838 // } | |
1839 //} | |
1840 // | |
1841 //class SearchEngineImplTest_ExpectedMatch { | |
1842 // final Element _element; | |
1843 // | |
1844 // final MatchKind _kind; | |
1845 // | |
1846 // final MatchQuality _quality; | |
1847 // | |
1848 // SourceRange _range; | |
1849 // | |
1850 // final bool _qualified; | |
1851 // | |
1852 // SearchEngineImplTest_ExpectedMatch.con1(Element element, MatchKind kind, int
offset, int length) : this.con3(element, kind, MatchQuality.EXACT, offset, leng
th); | |
1853 // | |
1854 // SearchEngineImplTest_ExpectedMatch.con2(Element element, MatchKind kind, int
offset, int length, bool qualified) : this.con4(element, kind, MatchQuality.EXA
CT, offset, length, qualified); | |
1855 // | |
1856 // SearchEngineImplTest_ExpectedMatch.con3(Element element, MatchKind kind, Mat
chQuality quality, int offset, int length) : this.con4(element, kind, quality, o
ffset, length, false); | |
1857 // | |
1858 // SearchEngineImplTest_ExpectedMatch.con4(this._element, this._kind, this._qua
lity, int offset, int length, this._qualified) { | |
1859 // this._range = new SourceRange(offset, length); | |
1860 // } | |
1861 //} | |
1862 // | |
1863 //abstract class SearchEngineImplTest_SearchRunner<T> { | |
1864 // T run(OperationQueue queue, OperationProcessor processor, Index index, Searc
hEngine engine); | |
1865 //} | |
1866 // | |
1867 //class SearchFilter_SearchEngineImplTest_test_searchFunctionDeclarations_useFil
ter implements SearchFilter { | |
1868 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1869 // | |
1870 // SearchFilter_SearchEngineImplTest_test_searchFunctionDeclarations_useFilter(
this.SearchEngineImplTest_this); | |
1871 // | |
1872 // @override | |
1873 // bool passes(SearchMatch match) => identical(match.element, SearchEngineImplT
est_this._elementB); | |
1874 //} | |
1875 // | |
1876 //class SearchFilter_SearchEngineImplTest_test_searchFunctionDeclarations_useFil
ter_2 implements SearchFilter { | |
1877 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1878 // | |
1879 // SearchFilter_SearchEngineImplTest_test_searchFunctionDeclarations_useFilter_
2(this.SearchEngineImplTest_this); | |
1880 // | |
1881 // @override | |
1882 // bool passes(SearchMatch match) => identical(match.element, SearchEngineImplT
est_this._elementA); | |
1883 //} | |
1884 // | |
1885 //class SearchListener_SearchRunner_117_run implements SearchListener { | |
1886 // List<SearchMatch> matches; | |
1887 // | |
1888 // CountDownLatch latch; | |
1889 // | |
1890 // SearchListener_SearchRunner_117_run(this.matches, this.latch); | |
1891 // | |
1892 // @override | |
1893 // void matchFound(SearchMatch match) { | |
1894 // matches.add(match); | |
1895 // } | |
1896 // | |
1897 // @override | |
1898 // void searchComplete() { | |
1899 // latch.countDown(); | |
1900 // } | |
1901 //} | |
1902 // | |
1903 //class SearchRunner_SearchEngineImplTest_fail_searchAssignedTypes_assignments i
mplements SearchEngineImplTest_SearchRunner { | |
1904 // FieldElement fieldElement; | |
1905 // | |
1906 // SearchRunner_SearchEngineImplTest_fail_searchAssignedTypes_assignments(this.
fieldElement, this.fieldElement); | |
1907 // | |
1908 // @override | |
1909 // Set<DartType> run(OperationQueue queue, OperationProcessor processor, Index
index, SearchEngine engine) => engine.searchAssignedTypes(fieldElement, new Sear
chScope_SearchRunner_109_run()); | |
1910 //} | |
1911 // | |
1912 //class SearchRunner_SearchEngineImplTest_fail_searchAssignedTypes_initializers
implements SearchEngineImplTest_SearchRunner { | |
1913 // FieldElement fieldElement; | |
1914 // | |
1915 // SearchRunner_SearchEngineImplTest_fail_searchAssignedTypes_initializers(this
.fieldElement); | |
1916 // | |
1917 // @override | |
1918 // Set<DartType> run(OperationQueue queue, OperationProcessor processor, Index
index, SearchEngine engine) => engine.searchAssignedTypes(fieldElement, null); | |
1919 //} | |
1920 // | |
1921 //class SearchRunner_SearchEngineImplTest_searchDeclarationsAsync implements Sea
rchEngineImplTest_SearchRunner { | |
1922 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1923 // | |
1924 // String methodName; | |
1925 // | |
1926 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1927 // | |
1928 // List<SearchMatch> matches; | |
1929 // | |
1930 // CountDownLatch latch; | |
1931 // | |
1932 // SearchRunner_SearchEngineImplTest_searchDeclarationsAsync(this.SearchEngineI
mplTest_this, this.methodName, this.SearchEngineImplTest_this, this.matches, thi
s.latch, this.SearchEngineImplTest_this, this.methodName, this.SearchEngineImplT
est_this, this.matches, this.latch); | |
1933 // | |
1934 // @override | |
1935 // List<SearchMatch> run(OperationQueue queue, OperationProcessor processor, In
dex index, SearchEngine engine) { | |
1936 // CountDownLatch latch = new CountDownLatch(1); | |
1937 // List<SearchMatch> matches = []; | |
1938 // engine.runtimeType.getMethod(methodName, [SearchScope, SearchPattern, Sear
chFilter, SearchListener]).invoke(engine, [ | |
1939 // SearchEngineImplTest_this._scope, | |
1940 // SearchEngineImplTest_this._pattern, | |
1941 // SearchEngineImplTest_this._filter, | |
1942 // new SearchListener_SearchRunner_117_run(matches, latch)]); | |
1943 // latch.await(30, TimeUnit.SECONDS); | |
1944 // return matches; | |
1945 // } | |
1946 //} | |
1947 // | |
1948 //class SearchRunner_SearchEngineImplTest_searchDeclarationsSync implements Sear
chEngineImplTest_SearchRunner { | |
1949 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1950 // | |
1951 // String methodName; | |
1952 // | |
1953 // SearchRunner_SearchEngineImplTest_searchDeclarationsSync(this.SearchEngineIm
plTest_this, this.methodName); | |
1954 // | |
1955 // @override | |
1956 // List<SearchMatch> run(OperationQueue queue, OperationProcessor processor, In
dex index, SearchEngine engine) => engine.runtimeType.getMethod(methodName, [Sea
rchScope, SearchPattern, SearchFilter]).invoke(engine, [ | |
1957 // SearchEngineImplTest_this._scope, | |
1958 // SearchEngineImplTest_this._pattern, | |
1959 // SearchEngineImplTest_this._filter]) as List<SearchMatch>; | |
1960 //} | |
1961 // | |
1962 //class SearchRunner_SearchEngineImplTest_searchReferencesSync implements Search
EngineImplTest_SearchRunner { | |
1963 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1964 // | |
1965 // String methodName; | |
1966 // | |
1967 // Type clazz; | |
1968 // | |
1969 // Object element; | |
1970 // | |
1971 // SearchRunner_SearchEngineImplTest_searchReferencesSync(this.SearchEngineImpl
Test_this, this.methodName, this.clazz, this.element); | |
1972 // | |
1973 // @override | |
1974 // List<SearchMatch> run(OperationQueue queue, OperationProcessor processor, In
dex index, SearchEngine engine) { | |
1975 // // pass some operation to wait if search will not call processor | |
1976 // queue.enqueue(mock(IndexOperation)); | |
1977 // // run actual search | |
1978 // return engine.runtimeType.getMethod(methodName, [clazz, SearchScope, Searc
hFilter]).invoke(engine, [ | |
1979 // element, | |
1980 // SearchEngineImplTest_this._scope, | |
1981 // SearchEngineImplTest_this._filter]) as List<SearchMatch>; | |
1982 // } | |
1983 //} | |
1984 // | |
1985 //class SearchRunner_SearchEngineImplTest_test_searchDeclarations_String impleme
nts SearchEngineImplTest_SearchRunner { | |
1986 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1987 // | |
1988 // SearchRunner_SearchEngineImplTest_test_searchDeclarations_String(this.Search
EngineImplTest_this); | |
1989 // | |
1990 // @override | |
1991 // List<SearchMatch> run(OperationQueue queue, OperationProcessor processor, In
dex index, SearchEngine engine) => engine.searchDeclarations("test", SearchEngin
eImplTest_this._scope, SearchEngineImplTest_this._filter); | |
1992 //} | |
1993 // | |
1994 //class SearchRunner_SearchEngineImplTest_test_searchSubtypes implements SearchE
ngineImplTest_SearchRunner { | |
1995 // final SearchEngineImplTest SearchEngineImplTest_this; | |
1996 // | |
1997 // ClassElement referencedElement; | |
1998 // | |
1999 // SearchRunner_SearchEngineImplTest_test_searchSubtypes(this.SearchEngineImplT
est_this, this.referencedElement); | |
2000 // | |
2001 // @override | |
2002 // List<SearchMatch> run(OperationQueue queue, OperationProcessor processor, In
dex index, SearchEngine engine) => engine.searchSubtypes(referencedElement, Sear
chEngineImplTest_this._scope, SearchEngineImplTest_this._filter); | |
2003 //} | |
2004 // | |
2005 //class SearchScope_SearchRunner_109_run implements SearchScope { | |
2006 // @override | |
2007 // bool encloses(Element element) => !identical(element, _elementC); | |
2008 //} | |
2009 // | |
2010 //class Thread_SearchEngineImplTest_runSearch extends Thread { | |
2011 // OperationProcessor processor; | |
2012 // | |
2013 // Thread_SearchEngineImplTest_runSearch(this.processor) : super(); | |
2014 // | |
2015 // @override | |
2016 // void run() { | |
2017 // processor.run(); | |
2018 // } | |
2019 //} | |
2020 // | |
2021 //class UniverseSearchScopeTest extends EngineTestCase { | |
2022 // SearchScope _scope = new UniverseSearchScope(); | |
2023 // | |
2024 // Element _element = mock(Element); | |
2025 // | |
2026 // void test_anyElement() { | |
2027 // JUnitTestCase.assertTrue(_scope.encloses(_element)); | |
2028 // } | |
2029 // | |
2030 // void test_nullElement() { | |
2031 // JUnitTestCase.assertTrue(_scope.encloses(null)); | |
2032 // } | |
2033 // | |
2034 // static dartSuite() { | |
2035 // _ut.group('UniverseSearchScopeTest', () { | |
2036 // _ut.test('test_anyElement', () { | |
2037 // final __test = new UniverseSearchScopeTest(); | |
2038 // runJUnitTest(__test, __test.test_anyElement); | |
2039 // }); | |
2040 // _ut.test('test_nullElement', () { | |
2041 // final __test = new UniverseSearchScopeTest(); | |
2042 // runJUnitTest(__test, __test.test_nullElement); | |
2043 // }); | |
2044 // }); | |
2045 // } | |
2046 //} | |
2047 // | |
2048 //class WildcardSearchPatternTest extends EngineTestCase { | |
2049 // Element _element = mock(Element); | |
2050 // | |
2051 // void test_caseInsensitive_false_contentMismatch() { | |
2052 // SearchPattern pattern = new WildcardSearchPattern("H*Map", false); | |
2053 // when(_element.displayName).thenReturn("Maps"); | |
2054 // // validate | |
2055 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
2056 // } | |
2057 // | |
2058 // void test_caseInsensitive_true_caseMismatch() { | |
2059 // SearchPattern pattern = new WildcardSearchPattern("H*MaP", false); | |
2060 // when(_element.displayName).thenReturn("HashMap"); | |
2061 // // validate | |
2062 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | |
2063 // } | |
2064 // | |
2065 // void test_caseSensitive_false_caseMismatch() { | |
2066 // SearchPattern pattern = new WildcardSearchPattern("H*MaP", true); | |
2067 // when(_element.displayName).thenReturn("HashMap"); | |
2068 // // validate | |
2069 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
2070 // } | |
2071 // | |
2072 // void test_caseSensitive_false_contentMismatch() { | |
2073 // SearchPattern pattern = new WildcardSearchPattern("H*Map", false); | |
2074 // when(_element.displayName).thenReturn("Maps"); | |
2075 // // validate | |
2076 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
2077 // } | |
2078 // | |
2079 // void test_caseSensitive_true() { | |
2080 // SearchPattern pattern = new WildcardSearchPattern("H*Ma?", false); | |
2081 // when(_element.displayName).thenReturn("HashMap"); | |
2082 // // validate | |
2083 // JUnitTestCase.assertSame(MatchQuality.EXACT, pattern.matches(_element)); | |
2084 // } | |
2085 // | |
2086 // void test_nullElement() { | |
2087 // SearchPattern pattern = new WildcardSearchPattern("H*Map", false); | |
2088 // // validate | |
2089 // JUnitTestCase.assertSame(null, pattern.matches(null)); | |
2090 // } | |
2091 // | |
2092 // void test_nullName() { | |
2093 // SearchPattern pattern = new WildcardSearchPattern("H*Map", false); | |
2094 // when(_element.displayName).thenReturn(null); | |
2095 // // validate | |
2096 // JUnitTestCase.assertSame(null, pattern.matches(_element)); | |
2097 // } | |
2098 // | |
2099 // static dartSuite() { | |
2100 // _ut.group('WildcardSearchPatternTest', () { | |
2101 // _ut.test('test_caseInsensitive_false_contentMismatch', () { | |
2102 // final __test = new WildcardSearchPatternTest(); | |
2103 // runJUnitTest(__test, __test.test_caseInsensitive_false_contentMismatch
); | |
2104 // }); | |
2105 // _ut.test('test_caseInsensitive_true_caseMismatch', () { | |
2106 // final __test = new WildcardSearchPatternTest(); | |
2107 // runJUnitTest(__test, __test.test_caseInsensitive_true_caseMismatch); | |
2108 // }); | |
2109 // _ut.test('test_caseSensitive_false_caseMismatch', () { | |
2110 // final __test = new WildcardSearchPatternTest(); | |
2111 // runJUnitTest(__test, __test.test_caseSensitive_false_caseMismatch); | |
2112 // }); | |
2113 // _ut.test('test_caseSensitive_false_contentMismatch', () { | |
2114 // final __test = new WildcardSearchPatternTest(); | |
2115 // runJUnitTest(__test, __test.test_caseSensitive_false_contentMismatch); | |
2116 // }); | |
2117 // _ut.test('test_caseSensitive_true', () { | |
2118 // final __test = new WildcardSearchPatternTest(); | |
2119 // runJUnitTest(__test, __test.test_caseSensitive_true); | |
2120 // }); | |
2121 // _ut.test('test_nullElement', () { | |
2122 // final __test = new WildcardSearchPatternTest(); | |
2123 // runJUnitTest(__test, __test.test_nullElement); | |
2124 // }); | |
2125 // _ut.test('test_nullName', () { | |
2126 // final __test = new WildcardSearchPatternTest(); | |
2127 // runJUnitTest(__test, __test.test_nullName); | |
2128 // }); | |
2129 // }); | |
2130 // } | |
2131 //} | |
2132 // | |
2133 //main() { | |
2134 // CountingSearchListenerTest.dartSuite(); | |
2135 // FilterSearchListenerTest.dartSuite(); | |
2136 // GatheringSearchListenerTest.dartSuite(); | |
2137 // NameMatchingSearchListenerTest.dartSuite(); | |
2138 // LibrarySearchScopeTest.dartSuite(); | |
2139 // UniverseSearchScopeTest.dartSuite(); | |
2140 // SearchEngineImplTest.dartSuite(); | |
2141 // AndSearchPatternTest.dartSuite(); | |
2142 // CamelCaseSearchPatternTest.dartSuite(); | |
2143 // ExactSearchPatternTest.dartSuite(); | |
2144 // OrSearchPatternTest.dartSuite(); | |
2145 // PrefixSearchPatternTest.dartSuite(); | |
2146 // RegularExpressionSearchPatternTest.dartSuite(); | |
2147 // WildcardSearchPatternTest.dartSuite(); | |
2148 //} | |
OLD | NEW |