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

Committed test to validate bug 60939

This commit is contained in:
John Camelon 2004-05-20 14:12:48 +00:00
parent 0fa4e89147
commit 9dec664073

View file

@ -1836,5 +1836,35 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
public void testBug39676_tough() throws Exception public void testBug39676_tough() throws Exception
{ {
parse( "int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };", true, ParserLanguage.C ); //$NON-NLS-1$ parse( "int widths[] = { [0 ... 9] = 1, [10 ... 99] = 2, [100] = 3 };", true, ParserLanguage.C ); //$NON-NLS-1$
}
public void testBug60939() throws Exception
{
for( int i = 0; i < 2; ++i )
{
Writer writer = new StringWriter();
writer.write( "namespace ABC { class DEF { }; }\n"); //$NON-NLS-1$
if( i == 0 )
writer.write( "using namespace ABC;\n"); //$NON-NLS-1$
else
writer.write( "using ABC::DEF;\n"); //$NON-NLS-1$
writer.write( "class GHI : public DEF { };"); //$NON-NLS-1$
Iterator d = parse( writer.toString() ).getDeclarations();
IASTNamespaceDefinition ABC = (IASTNamespaceDefinition) d.next();
if( i == 0 )
assertTrue( d.next() instanceof IASTUsingDirective );
else
assertTrue( d.next() instanceof IASTUsingDeclaration );
IASTClassSpecifier GHI = (IASTClassSpecifier) ((IASTAbstractTypeSpecifierDeclaration)d.next()).getTypeSpecifier();
Iterator baseClauses = GHI.getBaseClauses();
IASTBaseSpecifier baseClause = (IASTBaseSpecifier) baseClauses.next();
IASTClassSpecifier DEF = (IASTClassSpecifier) baseClause.getParentClassSpecifier();
String [] theTruth = new String[2];
theTruth[0] = "ABC"; //$NON-NLS-1$
theTruth[1] = "DEF"; //$NON-NLS-1$
qualifiedNamesEquals( DEF.getFullyQualifiedName(), theTruth );
}
} }
} }