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

Tests for bug 43241.

This commit is contained in:
John Camelon 2005-07-12 18:15:35 +00:00
parent be9ff67ffa
commit c12eff4507
2 changed files with 25 additions and 1 deletions

View file

@ -102,6 +102,10 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
public class AST2CPPTests extends AST2BaseTest {
public void testBug43241() throws Exception {
parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$
}
public void testBug40768() throws Exception {
StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$
buffer.append( "int (*zzz2) (char); \n" ); //$NON-NLS-1$
@ -113,6 +117,15 @@ public class AST2CPPTests extends AST2BaseTest {
assertNoProblemBindings( col );
}
protected void parseAndCheckBindings( String code ) throws Exception
{
IASTTranslationUnit tu = parse( code, ParserLanguage.CPP ); //$NON-NLS-1$
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
assertNoProblemBindings( col );
}
public void testBug40422() throws Exception
{
IASTTranslationUnit tu = parse( "class A { int y; }; int A::* x = 0;", ParserLanguage.CPP ); //$NON-NLS-1$

View file

@ -77,7 +77,6 @@ import org.eclipse.cdt.core.dom.ast.c.ICArrayType;
import org.eclipse.cdt.core.dom.ast.c.ICExternalBinding;
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
import org.eclipse.cdt.core.parser.ParserLanguage;
import org.eclipse.cdt.core.parser.tests.ast2.AST2BaseTest.CPPNameCollector;
import org.eclipse.cdt.internal.core.dom.parser.ASTNode;
import org.eclipse.cdt.internal.core.dom.parser.c.CFunction;
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
@ -90,6 +89,10 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
*/
public class AST2Tests extends AST2BaseTest {
// public void testBug43241() throws Exception {
// parseAndCheckBindings( "int m(int); int (*pm)(int) = &m; int f(){} int f(int); int x = f((*pm)(5));" ); //$NON-NLS-1$
// }
public void testBug40768() throws Exception {
StringBuffer buffer = new StringBuffer( "int *zzz1 (char);\n" ); //$NON-NLS-1$
buffer.append( "int (*zzz2) (char); \n" ); //$NON-NLS-1$
@ -101,6 +104,14 @@ public class AST2Tests extends AST2BaseTest {
assertNoProblemBindings( col );
}
protected void parseAndCheckBindings( String code ) throws Exception
{
IASTTranslationUnit tu = parse( code, ParserLanguage.C ); //$NON-NLS-1$
CNameCollector col = new CNameCollector();
tu.accept(col);
assertNoProblemBindings( col );
}
public void testBasicFunction() throws Exception {
StringBuffer buff = new StringBuffer();
buff.append("int x;\n"); //$NON-NLS-1$