1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Removed use of a deprecated method.

This commit is contained in:
Sergey Prigogin 2011-10-17 14:22:14 -07:00
parent d335475bd0
commit 4e65505eba

View file

@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* QNX - Initial API and implementation * QNX - Initial API and implementation
* Markus Schorn (Wind River Systems) * Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.pdom.tests; package org.eclipse.cdt.internal.pdom.tests;
@ -183,6 +183,11 @@ public class DefDeclTests extends PDOMTestBase {
checkReference(binding, "ref" + testNum, ref); checkReference(binding, "ref" + testNum, ref);
} }
private IIndexFile getSingleFile(IIndexFileLocation ifl) throws CoreException {
IIndexFile[] files= pdom.getFiles(ILinkage.C_LINKAGE_ID, ifl);
assertEquals(1, files.length);
return files[0];
}
/* ------------------ Tests Started Here ------------------------ */ /* ------------------ Tests Started Here ------------------------ */
public void testInit() { public void testInit() {
// will fail if setUp fails, maybe timelimit is too small for warm-up // will fail if setUp fails, maybe timelimit is too small for warm-up
@ -237,7 +242,7 @@ public class DefDeclTests extends PDOMTestBase {
String elName = "foo" + "08"; String elName = "foo" + "08";
IIndexFileLocation ifl= IndexLocationFactory.getIFL((ITranslationUnit) cproject.findElement(new Path("func.c"))); IIndexFileLocation ifl= IndexLocationFactory.getIFL((ITranslationUnit) cproject.findElement(new Path("func.c")));
IIndexFile file= pdom.getFile(ILinkage.C_LINKAGE_ID, ifl); IIndexFile file= getSingleFile(ifl);
int offset= TestSourceReader.indexOfInFile("foo08();", new Path(ifl.getFullPath())); int offset= TestSourceReader.indexOfInFile("foo08();", new Path(ifl.getFullPath()));
IIndexName[] names= file.findNames(offset, 5); IIndexName[] names= file.findNames(offset, 5);
assertEquals(1, names.length); assertEquals(1, names.length);
@ -249,7 +254,7 @@ public class DefDeclTests extends PDOMTestBase {
// check the other file // check the other file
ifl= IndexLocationFactory.getIFL((ITranslationUnit) cproject.findElement(new Path("second.c"))); ifl= IndexLocationFactory.getIFL((ITranslationUnit) cproject.findElement(new Path("second.c")));
file= pdom.getFile(ILinkage.C_LINKAGE_ID, ifl); file= getSingleFile(ifl);
offset= TestSourceReader.indexOfInFile("foo08();", new Path(ifl.getFullPath())); offset= TestSourceReader.indexOfInFile("foo08();", new Path(ifl.getFullPath()));
names= file.findNames(offset, 5); names= file.findNames(offset, 5);
assertEquals(1, names.length); assertEquals(1, names.length);