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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 * @param filePath the path of the file being added | 166 * @param filePath the path of the file being added |
167 * @param contents the contents to be returned by the content provider for the
specified file | 167 * @param contents the contents to be returned by the content provider for the
specified file |
168 * @return the source object representing the added file | 168 * @return the source object representing the added file |
169 */ | 169 */ |
170 protected Source addSource(String filePath, String contents) { | 170 protected Source addSource(String filePath, String contents) { |
171 Source source = new FileBasedSource(createFile(filePath)); | 171 Source source = new FileBasedSource(createFile(filePath)); |
172 context.setContents(source, contents); | 172 context.setContents(source, contents); |
173 return source; | 173 return source; |
174 } | 174 } |
175 | 175 |
| 176 @Override |
| 177 protected void tearDown() throws Exception { |
| 178 context = null; |
| 179 super.tearDown(); |
| 180 } |
| 181 |
176 /** | 182 /** |
177 * Ensure that there are elements representing all of the types in the given a
rray of type names. | 183 * Ensure that there are elements representing all of the types in the given a
rray of type names. |
178 * | 184 * |
179 * @param unit the compilation unit containing the types | 185 * @param unit the compilation unit containing the types |
180 * @param typeNames the names of the types that should be found | 186 * @param typeNames the names of the types that should be found |
181 */ | 187 */ |
182 private void assertTypes(CompilationUnitElement unit, String... typeNames) { | 188 private void assertTypes(CompilationUnitElement unit, String... typeNames) { |
183 assertNotNull(unit); | 189 assertNotNull(unit); |
184 ClassElement[] types = unit.getTypes(); | 190 ClassElement[] types = unit.getTypes(); |
185 assertLength(typeNames.length, types); | 191 assertLength(typeNames.length, types); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 new Class[] {Source.class}); | 224 new Class[] {Source.class}); |
219 method.setAccessible(true); | 225 method.setAccessible(true); |
220 Library library = (Library) method.invoke(resolver, librarySource); | 226 Library library = (Library) method.invoke(resolver, librarySource); |
221 LibraryElement element = builder.buildLibrary(library); | 227 LibraryElement element = builder.buildLibrary(library); |
222 GatheringErrorListener listener = new GatheringErrorListener(); | 228 GatheringErrorListener listener = new GatheringErrorListener(); |
223 listener.addAll(resolver.getErrorListener()); | 229 listener.addAll(resolver.getErrorListener()); |
224 listener.assertErrorsWithCodes(expectedErrorCodes); | 230 listener.assertErrorsWithCodes(expectedErrorCodes); |
225 return element; | 231 return element; |
226 } | 232 } |
227 } | 233 } |
OLD | NEW |