From 5d8ec23f029485ddd6e067ae68aa2ce2fae3992f Mon Sep 17 00:00:00 2001 From: John Camelon Date: Thu, 14 Jul 2005 15:27:50 +0000 Subject: [PATCH] Checked in JUnit for regression purposes. --- .../eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java | 6 ++++++ .../org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index 5e6765e7136..ae1e55b4835 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -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$ diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 9de56e33a56..afa0ba27ea6 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -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$