1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

Checked in JUnit for regression purposes.

This commit is contained in:
John Camelon 2005-07-14 15:27:50 +00:00
parent db6c8a053b
commit 5d8ec23f02
2 changed files with 13 additions and 0 deletions

View file

@ -15,6 +15,7 @@ package org.eclipse.cdt.core.parser.tests.ast2;
import java.util.Iterator;
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
@ -106,6 +107,11 @@ public class AST2CPPTests extends AST2BaseTest {
parseAndCheckBindings( "struct A{};typedef int (*F) (A*);" ); //$NON-NLS-1$
}
public void testBug75340() throws Exception {
IASTTranslationUnit tu = parseAndCheckBindings( "void f(int i = 0, int * p = 0);"); //$NON-NLS-1$
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0];
assertEquals( ASTSignatureUtil.getParameterSignature( sd.getDeclarators()[0] ), "(int, int *)" ); //$NON-NLS-1$
}
public void testBug79540() throws Exception {
StringBuffer buffer = new StringBuffer( "#define REF_WRAP(e) class A { public: A (){ } A& foo2(e& v) { return *this; } }\n" ); //$NON-NLS-1$

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.core.parser.tests.ast2;
import java.util.Iterator;
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
@ -93,6 +94,12 @@ public class AST2Tests extends AST2BaseTest {
parseAndCheckBindings( "struct A{};typedef int (*F) (A*);" ); //$NON-NLS-1$
}
public void testBug75340() throws Exception {
IASTTranslationUnit tu = parseAndCheckBindings( "void f(int i = 0, int * p = 0);"); //$NON-NLS-1$
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) tu.getDeclarations()[0];
assertEquals( ASTSignatureUtil.getParameterSignature( sd.getDeclarators()[0] ), "(int, int *)" ); //$NON-NLS-1$
}
public void testBug78103() throws Exception {
StringBuffer buffer = new StringBuffer( "int *p1; int *p2;\n" ); //$NON-NLS-1$
buffer.append( "union {\n" ); //$NON-NLS-1$