OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 found = true; | 128 found = true; |
129 break; | 129 break; |
130 } | 130 } |
131 } | 131 } |
132 if (!found) { | 132 if (!found) { |
133 fail("Not found: " + msg); | 133 fail("Not found: " + msg); |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 private final IndexStore indexStore = IndexFactory.newSplitIndexStore(new Memo
ryNodeManager()); | 138 private IndexStore indexStore = IndexFactory.newSplitIndexStore(new MemoryNode
Manager()); |
139 | 139 |
140 private static final AnalysisContext CONTEXT = mock(AnalysisContext.class); | 140 private static final AnalysisContext CONTEXT = mock(AnalysisContext.class); |
141 private int nextLocationId = 0; | 141 private int nextLocationId = 0; |
142 private SearchScope scope; | 142 private SearchScope scope; |
143 private SearchPattern pattern = null; | 143 private SearchPattern pattern = null; |
144 private SearchFilter filter = null; | 144 private SearchFilter filter = null; |
145 | 145 |
146 private final Source source = mock(Source.class); | 146 private final Source source = mock(Source.class); |
147 private final CompilationUnitElement unitElement = mock(CompilationUnitElement
.class); | 147 private final CompilationUnitElement unitElement = mock(CompilationUnitElement
.class); |
148 private final LibraryElement libraryElement = mock(LibraryElement.class); | 148 private final LibraryElement libraryElement = mock(LibraryElement.class); |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 when(elementE.getContext()).thenReturn(CONTEXT); | 1218 when(elementE.getContext()).thenReturn(CONTEXT); |
1219 when(CONTEXT.getElement(elementA.getLocation())).thenReturn(elementA); | 1219 when(CONTEXT.getElement(elementA.getLocation())).thenReturn(elementA); |
1220 when(CONTEXT.getElement(elementB.getLocation())).thenReturn(elementB); | 1220 when(CONTEXT.getElement(elementB.getLocation())).thenReturn(elementB); |
1221 when(CONTEXT.getElement(elementC.getLocation())).thenReturn(elementC); | 1221 when(CONTEXT.getElement(elementC.getLocation())).thenReturn(elementC); |
1222 when(CONTEXT.getElement(elementD.getLocation())).thenReturn(elementD); | 1222 when(CONTEXT.getElement(elementD.getLocation())).thenReturn(elementD); |
1223 when(CONTEXT.getElement(elementE.getLocation())).thenReturn(elementE); | 1223 when(CONTEXT.getElement(elementE.getLocation())).thenReturn(elementE); |
1224 // start indexing | 1224 // start indexing |
1225 assertTrue(indexStore.aboutToIndexDart(CONTEXT, unitElement)); | 1225 assertTrue(indexStore.aboutToIndexDart(CONTEXT, unitElement)); |
1226 } | 1226 } |
1227 | 1227 |
| 1228 @Override |
| 1229 protected void tearDown() throws Exception { |
| 1230 indexStore = null; |
| 1231 super.tearDown(); |
| 1232 } |
| 1233 |
1228 private void defineFunctionsAB(LibraryElement library) { | 1234 private void defineFunctionsAB(LibraryElement library) { |
1229 { | 1235 { |
1230 when(elementA.getAncestor(LibraryElement.class)).thenReturn(library); | 1236 when(elementA.getAncestor(LibraryElement.class)).thenReturn(library); |
1231 Location locationA = new Location(elementA, 1, 2); | 1237 Location locationA = new Location(elementA, 1, 2); |
1232 indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION, lo
cationA); | 1238 indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION, lo
cationA); |
1233 } | 1239 } |
1234 { | 1240 { |
1235 when(elementB.getAncestor(LibraryElement.class)).thenReturn(library); | 1241 when(elementB.getAncestor(LibraryElement.class)).thenReturn(library); |
1236 Location locationB = new Location(elementB, 10, 20); | 1242 Location locationB = new Location(elementB, 10, 20); |
1237 indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION, lo
cationB); | 1243 indexStore.recordRelationship(library, IndexConstants.DEFINES_FUNCTION, lo
cationB); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 } | 1373 } |
1368 | 1374 |
1369 private List<SearchMatch> searchVariableDeclarationsAsync() throws Exception { | 1375 private List<SearchMatch> searchVariableDeclarationsAsync() throws Exception { |
1370 return searchDeclarationsAsync("searchVariableDeclarations"); | 1376 return searchDeclarationsAsync("searchVariableDeclarations"); |
1371 } | 1377 } |
1372 | 1378 |
1373 private List<SearchMatch> searchVariableDeclarationsSync() throws Exception { | 1379 private List<SearchMatch> searchVariableDeclarationsSync() throws Exception { |
1374 return searchDeclarationsSync("searchVariableDeclarations"); | 1380 return searchDeclarationsSync("searchVariableDeclarations"); |
1375 } | 1381 } |
1376 } | 1382 } |
OLD | NEW |