mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Updated testcase for bug 179322.
This commit is contained in:
parent
a197545748
commit
ea528b7933
1 changed files with 52 additions and 63 deletions
|
@ -16,9 +16,6 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.TestSuite;
|
import junit.framework.TestSuite;
|
||||||
|
@ -47,9 +44,7 @@ import org.eclipse.cdt.core.index.IIndexMacro;
|
||||||
import org.eclipse.cdt.core.index.IIndexName;
|
import org.eclipse.cdt.core.index.IIndexName;
|
||||||
import org.eclipse.cdt.core.index.IndexFilter;
|
import org.eclipse.cdt.core.index.IndexFilter;
|
||||||
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
import org.eclipse.cdt.core.index.IndexLocationFactory;
|
||||||
import org.eclipse.cdt.core.model.CoreModel;
|
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.model.IPathEntry;
|
|
||||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
import org.eclipse.cdt.core.testplugin.CProjectHelper;
|
||||||
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
import org.eclipse.cdt.core.testplugin.CTestPlugin;
|
||||||
|
@ -87,6 +82,8 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void tearDown() throws CoreException {
|
protected void tearDown() throws CoreException {
|
||||||
|
TestScannerProvider.sIncludeFiles= TestScannerProvider.sIncludes=
|
||||||
|
TestScannerProvider.sMacroFiles= null;
|
||||||
if (fCProject != null) {
|
if (fCProject != null) {
|
||||||
CProjectHelper.delete(fCProject);
|
CProjectHelper.delete(fCProject);
|
||||||
}
|
}
|
||||||
|
@ -208,7 +205,6 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
|
|
||||||
public void test164360_1() throws Exception {
|
public void test164360_1() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
try {
|
|
||||||
IFile include= TestSourceReader.createFile(fCProject.getProject(), "test164360.h", "");
|
IFile include= TestSourceReader.createFile(fCProject.getProject(), "test164360.h", "");
|
||||||
TestScannerProvider.sIncludeFiles= new String[]{include.getLocation().toOSString()};
|
TestScannerProvider.sIncludeFiles= new String[]{include.getLocation().toOSString()};
|
||||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164360.cpp", "");
|
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164360.cpp", "");
|
||||||
|
@ -231,14 +227,9 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
TestScannerProvider.sIncludeFiles= null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void test164360_2() throws Exception {
|
public void test164360_2() throws Exception {
|
||||||
waitForIndexer();
|
waitForIndexer();
|
||||||
try {
|
|
||||||
IFile include= TestSourceReader.createFile(fCProject.getProject(), "test164360.h", "");
|
IFile include= TestSourceReader.createFile(fCProject.getProject(), "test164360.h", "");
|
||||||
TestScannerProvider.sMacroFiles= new String[]{include.getLocation().toOSString()};
|
TestScannerProvider.sMacroFiles= new String[]{include.getLocation().toOSString()};
|
||||||
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164360.cpp", "");
|
IFile file= TestSourceReader.createFile(fCProject.getProject(), "test164360.cpp", "");
|
||||||
|
@ -261,10 +252,6 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
fIndex.releaseReadLock();
|
fIndex.releaseReadLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
|
||||||
TestScannerProvider.sMacroFiles= null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// #define macro164500 1
|
// #define macro164500 1
|
||||||
// #undef macro164500
|
// #undef macro164500
|
||||||
|
@ -549,24 +536,26 @@ public class IndexBugsTests extends BaseTestCase {
|
||||||
* Linked headers, referenced via include <> syntax are missed
|
* Linked headers, referenced via include <> syntax are missed
|
||||||
*/
|
*/
|
||||||
public void _test179322() throws Exception {
|
public void _test179322() throws Exception {
|
||||||
|
|
||||||
String baseDir= FileLocator.toFileURL(FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path("/resources/indexTests/bugs/179322"), null)).getFile();
|
String baseDir= FileLocator.toFileURL(FileLocator.find(CTestPlugin.getDefault().getBundle(), new Path("/resources/indexTests/bugs/179322"), null)).getFile();
|
||||||
IFolder content= fCProject.getProject().getFolder("content");
|
IFolder content= fCProject.getProject().getFolder("content");
|
||||||
content.createLink(new Path(baseDir), IResource.NONE, null);
|
content.createLink(new Path(baseDir), IResource.NONE, null);
|
||||||
|
// List entries= new ArrayList(Arrays.asList(CoreModel.getRawPathEntries(fCProject)));
|
||||||
|
// entries.add(
|
||||||
|
// CoreModel.newIncludeEntry(fCProject.getPath(),
|
||||||
|
// null, content.getLocation(), true));
|
||||||
|
// entries.add(
|
||||||
|
// CoreModel.newIncludeEntry(fCProject.getPath(),
|
||||||
|
// null, content.getLocation(), false));
|
||||||
|
// entries.add(CoreModel.newSourceEntry(content.getProjectRelativePath()));
|
||||||
|
// fCProject.setRawPathEntries(
|
||||||
|
// (IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]),
|
||||||
|
// new NullProgressMonitor()
|
||||||
|
// );
|
||||||
|
|
||||||
// Setup path entries
|
TestScannerProvider.sIncludes= new String[] {
|
||||||
List entries= new ArrayList(Arrays.asList(CoreModel.getRawPathEntries(fCProject)));
|
content.getLocation().toString()
|
||||||
entries.add(
|
};
|
||||||
CoreModel.newIncludeEntry(fCProject.getPath(),
|
|
||||||
null, content.getLocation(), true));
|
|
||||||
entries.add(
|
|
||||||
CoreModel.newIncludeEntry(fCProject.getPath(),
|
|
||||||
null, content.getLocation(), false));
|
|
||||||
entries.add(CoreModel.newSourceEntry(content.getProjectRelativePath()));
|
|
||||||
fCProject.setRawPathEntries(
|
|
||||||
(IPathEntry[]) entries.toArray(new IPathEntry[entries.size()]),
|
|
||||||
new NullProgressMonitor()
|
|
||||||
);
|
|
||||||
|
|
||||||
CCorePlugin.getIndexManager().reindex(fCProject);
|
CCorePlugin.getIndexManager().reindex(fCProject);
|
||||||
CCorePlugin.getIndexManager().joinIndexer(10000, NPM);
|
CCorePlugin.getIndexManager().joinIndexer(10000, NPM);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue