mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Committed JUnits to demonstrate behaviour of old parser re: bug 100992.
This commit is contained in:
parent
0e56897a3f
commit
f9189b1ee4
2 changed files with 42 additions and 0 deletions
|
@ -2538,5 +2538,26 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
|
|||
parse(writer.toString());
|
||||
}
|
||||
|
||||
public void testBug100992() throws Exception {
|
||||
Writer writer = new StringWriter();
|
||||
writer.write( "class String { public: String(); ~String(); };"); //$NON-NLS-1$
|
||||
writer.write( "String::String(){}"); //$NON-NLS-1$
|
||||
writer.write( "String::~String(){}"); //$NON-NLS-1$
|
||||
Iterator i = parse( writer.toString() ).getDeclarations();
|
||||
IASTAbstractTypeSpecifierDeclaration StringDecl = (IASTAbstractTypeSpecifierDeclaration) i.next();
|
||||
Iterator members = ((IASTClassSpecifier)StringDecl.getTypeSpecifier()).getDeclarations();
|
||||
IASTMethod cons_decl = (IASTMethod) members.next();
|
||||
assertTrue( cons_decl.isConstructor() );
|
||||
IASTMethod dest_decl = (IASTMethod) members.next();
|
||||
assertTrue( dest_decl.isDestructor() );
|
||||
assertFalse( members.hasNext() );
|
||||
IASTMethod cons_defn = (IASTMethod) i.next();
|
||||
assertTrue( cons_defn.isConstructor() );
|
||||
IASTMethod dest_defn = (IASTMethod) i.next();
|
||||
assertTrue( dest_defn.isDestructor() );
|
||||
assertFalse( i.hasNext() );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2219,4 +2219,25 @@ public class QuickParseASTTests extends BaseASTTest
|
|||
writer.write( ".5,4x,\\002|proj g|= \\002,1p,d12.5)\";" ); //$NON-NLS-1$
|
||||
IASTVariable v = (IASTVariable) assertSoleDeclaration( writer.toString(), ParserLanguage.C );
|
||||
}
|
||||
|
||||
public void testBug100992() throws Exception {
|
||||
Writer writer = new StringWriter();
|
||||
writer.write( "class String { public: String(); ~String(); };"); //$NON-NLS-1$
|
||||
writer.write( "String::String(){}"); //$NON-NLS-1$
|
||||
writer.write( "String::~String(){}"); //$NON-NLS-1$
|
||||
Iterator i = parse( writer.toString() ).getDeclarations();
|
||||
IASTAbstractTypeSpecifierDeclaration StringDecl = (IASTAbstractTypeSpecifierDeclaration) i.next();
|
||||
Iterator members = ((IASTClassSpecifier)StringDecl.getTypeSpecifier()).getDeclarations();
|
||||
IASTMethod cons_decl = (IASTMethod) members.next();
|
||||
// this unfortunately doesn't work in QUICK_PARSE
|
||||
// assertTrue( cons_decl.isConstructor() );
|
||||
IASTMethod dest_decl = (IASTMethod) members.next();
|
||||
// assertTrue( dest_decl.isDestructor() );
|
||||
assertFalse( members.hasNext() );
|
||||
IASTFunction cons_defn = (IASTFunction) i.next();
|
||||
assertFalse( cons_defn instanceof IASTMethod );
|
||||
IASTFunction dest_defn = (IASTFunction) i.next();
|
||||
assertFalse( dest_defn instanceof IASTMethod );
|
||||
assertFalse( i.hasNext() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue