1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 14:55:41 +02:00

Testcase for bug 191315.

This commit is contained in:
Markus Schorn 2007-12-10 14:36:08 +00:00
parent 7035bbb480
commit 5801276291
3 changed files with 54 additions and 1 deletions

View file

@ -50,7 +50,7 @@ public abstract class AbstractContentAssistTest extends BaseUITestCase {
public static final int COMPARE_DISP_STRINGS = 1;
public static final int COMPARE_REP_STRINGS = 2;
private ICProject fCProject;
protected ICProject fCProject;
private IFile fCFile;
protected ITextEditor fEditor;
private boolean fIsCpp;

View file

@ -21,6 +21,7 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
/**
* A collection of code completion tests.
@ -895,4 +896,30 @@ public class CompletionTests extends AbstractContentAssistTest {
final String[] expected= new String[0];
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
}
// #ifdef __cplusplus__
// extern "C" {
// #endif
// void c_linkage();
// #ifdef __cplusplus__
// }
// #endif
// #include "header191315.h"
// #include "header191315.h"
// void xxx() { c_lin/*cursor*/
public void testExtenC_bug191315() throws Exception {
StringBuffer[] content= getContentsForTest(3);
createFile(fProject, "header191315.h", content[0].toString());
createFile(fProject, "source191315.c", content[0].toString());
createFile(fProject, "source191315.cpp", content[0].toString());
IFile dfile= createFile(fProject, "header191315.h", content[0].toString());
TestSourceReader.waitUntilFileIsIndexed(CCorePlugin.getIndexManager().getIndex(fCProject), dfile, 8000);
final String[] expected= {
"c_linkage()"
};
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
}
}

View file

@ -21,6 +21,7 @@ import org.eclipse.jface.text.IDocument;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
/**
* Completion tests for plain C.
@ -188,4 +189,29 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
final String[] expected= new String[0];
assertCompletionResults(expected);
}
// #ifdef __cplusplus__
// extern "C" {
// #endif
// void c_linkage();
// #ifdef __cplusplus__
// }
// #endif
// #include "header191315.h"
// #include "header191315.h"
// void xxx() { c_lin/*cursor*/
public void testExtenC_bug191315() throws Exception {
StringBuffer[] content= getContentsForTest(3);
createFile(fProject, "header191315.h", content[0].toString());
createFile(fProject, "source191315.c", content[0].toString());
createFile(fProject, "source191315.cpp", content[0].toString());
IFile dfile= createFile(fProject, "header191315.h", content[0].toString());
TestSourceReader.waitUntilFileIsIndexed(CCorePlugin.getIndexManager().getIndex(fCProject), dfile, 8000);
final String[] expected= {
"c_linkage(void)"
};
assertCompletionResults(expected);
}
}