mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Test to validate fix of Bug 40768 [Parser] Problems with nested declarators
This commit is contained in:
parent
13f1d71825
commit
be9ff67ffa
2 changed files with 23 additions and 0 deletions
|
@ -102,6 +102,17 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
|
|
||||||
public class AST2CPPTests extends AST2BaseTest {
|
public class AST2CPPTests extends AST2BaseTest {
|
||||||
|
|
||||||
|
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$
|
||||||
|
buffer.append( "int ((*zzz3)) (char); \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append( "int (*(zzz4)) (char); \n" ); //$NON-NLS-1$
|
||||||
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP ); //$NON-NLS-1$
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
assertNoProblemBindings( col );
|
||||||
|
}
|
||||||
|
|
||||||
public void testBug40422() throws Exception
|
public void testBug40422() throws Exception
|
||||||
{
|
{
|
||||||
IASTTranslationUnit tu = parse( "class A { int y; }; int A::* x = 0;", ParserLanguage.CPP ); //$NON-NLS-1$
|
IASTTranslationUnit tu = parse( "class A { int y; }; int A::* x = 0;", ParserLanguage.CPP ); //$NON-NLS-1$
|
||||||
|
|
|
@ -77,6 +77,7 @@ 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.ICExternalBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
||||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
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.ASTNode;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CFunction;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CFunction;
|
||||||
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
import org.eclipse.cdt.internal.core.dom.parser.c.CVisitor;
|
||||||
|
@ -89,6 +90,17 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
*/
|
*/
|
||||||
public class AST2Tests extends AST2BaseTest {
|
public class AST2Tests extends AST2BaseTest {
|
||||||
|
|
||||||
|
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$
|
||||||
|
buffer.append( "int ((*zzz3)) (char); \n" ); //$NON-NLS-1$
|
||||||
|
buffer.append( "int (*(zzz4)) (char); \n" ); //$NON-NLS-1$
|
||||||
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C ); //$NON-NLS-1$
|
||||||
|
CNameCollector col = new CNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
assertNoProblemBindings( col );
|
||||||
|
}
|
||||||
|
|
||||||
public void testBasicFunction() throws Exception {
|
public void testBasicFunction() throws Exception {
|
||||||
StringBuffer buff = new StringBuffer();
|
StringBuffer buff = new StringBuffer();
|
||||||
buff.append("int x;\n"); //$NON-NLS-1$
|
buff.append("int x;\n"); //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue