1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

Added tess.

This commit is contained in:
John Camelon 2005-05-06 15:17:35 +00:00
parent 5741db3525
commit 1843e1b6a0
3 changed files with 39 additions and 1 deletions

View file

@ -1095,4 +1095,6 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
} catch (Exception e) {
}
}
}

View file

@ -3944,7 +3944,6 @@ public class AST2CPPTests extends AST2BaseTest {
while( i.hasNext() )
{
IASTName n = (IASTName) i.next();
assertNotNull( n.resolveBinding());
assertFalse( n.resolveBinding() instanceof IProblemBinding );
}
}
@ -3962,4 +3961,11 @@ public class AST2CPPTests extends AST2BaseTest {
assertEquals( count, sum );
}
public void testBug85786() throws Exception {
IASTTranslationUnit tu = parse( "void f( int ); void foo () { void * p = &f; ( (void (*) (int)) p ) ( 1 ); }", ParserLanguage.C ); //$NON-NLS-1$
CPPNameCollector nameResolver = new CPPNameCollector();
tu.accept( nameResolver );
assertNoProblemBindings( nameResolver );
}
}

View file

@ -10,6 +10,8 @@
**********************************************************************/
package org.eclipse.cdt.core.parser.tests.ast2;
import java.util.Iterator;
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
@ -3082,4 +3084,32 @@ public class AST2Tests extends AST2BaseTest {
assertFalse( col.getName( i ).resolveBinding() instanceof IProblemBinding );
}
public void testBug85786() throws Exception {
IASTTranslationUnit tu = parse( "void f( int ); void foo () { void * p = &f; ( (void (*) (int)) p ) ( 1 ); }", ParserLanguage.C ); //$NON-NLS-1$
CNameCollector nameResolver = new CNameCollector();
tu.accept( nameResolver );
assertNoProblemBindings( nameResolver );
}
protected void assertNoProblemBindings(CNameCollector col) {
Iterator i = col.nameList.iterator();
while( i.hasNext() )
{
IASTName n = (IASTName) i.next();
assertFalse( n.resolveBinding() instanceof IProblemBinding );
}
}
protected void assertProblemBindings(CNameCollector col, int count ) {
Iterator i = col.nameList.iterator();
int sum = 0;
while( i.hasNext() )
{
IASTName n = (IASTName) i.next();
if( n.getBinding() instanceof IProblemBinding )
++sum;
}
assertEquals( count, sum );
}
}