mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 23:05:47 +02:00
Testcase for bug 191315.
This commit is contained in:
parent
7035bbb480
commit
5801276291
3 changed files with 54 additions and 1 deletions
|
@ -50,7 +50,7 @@ public abstract class AbstractContentAssistTest extends BaseUITestCase {
|
||||||
public static final int COMPARE_DISP_STRINGS = 1;
|
public static final int COMPARE_DISP_STRINGS = 1;
|
||||||
public static final int COMPARE_REP_STRINGS = 2;
|
public static final int COMPARE_REP_STRINGS = 2;
|
||||||
|
|
||||||
private ICProject fCProject;
|
protected ICProject fCProject;
|
||||||
private IFile fCFile;
|
private IFile fCFile;
|
||||||
protected ITextEditor fEditor;
|
protected ITextEditor fEditor;
|
||||||
private boolean fIsCpp;
|
private boolean fIsCpp;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.jface.text.IDocument;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of code completion tests.
|
* A collection of code completion tests.
|
||||||
|
@ -895,4 +896,30 @@ public class CompletionTests extends AbstractContentAssistTest {
|
||||||
final String[] expected= new String[0];
|
final String[] expected= new String[0];
|
||||||
assertCompletionResults(fCursorOffset, expected, AbstractContentAssistTest.COMPARE_REP_STRINGS);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import org.eclipse.jface.text.IDocument;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
|
||||||
|
import org.eclipse.cdt.core.testplugin.util.TestSourceReader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Completion tests for plain C.
|
* Completion tests for plain C.
|
||||||
|
@ -188,4 +189,29 @@ public class CompletionTests_PlainC extends AbstractContentAssistTest {
|
||||||
final String[] expected= new String[0];
|
final String[] expected= new String[0];
|
||||||
assertCompletionResults(expected);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue