1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

move tests for bug 71588

This commit is contained in:
Andrew Niefer 2004-09-21 20:30:58 +00:00
parent da4608ec2c
commit 1715e6bb76
2 changed files with 26 additions and 26 deletions

View file

@ -183,32 +183,7 @@ public class FailedCompleteParseASTTest extends CompleteParseBaseTest
// assertFalse(k.hasNext());
}
public void testTemplateFunctionInsideTemplateType_bug71588() throws Exception {
StringWriter writer = new StringWriter();
writer.write("template <typename T, typename U> \r\n"); //$NON-NLS-1$
writer.write("class A { \n"); //$NON-NLS-1$
writer.write("template <typename V> \n"); //$NON-NLS-1$
writer.write("T* foo(V); \n"); //$NON-NLS-1$
writer.write("}; \n"); //$NON-NLS-1$
writer.write("template <typename T, typename U> \n"); //$NON-NLS-1$
writer.write("template <typename V> \n"); //$NON-NLS-1$
writer.write("T* A<T, U>::foo(V) { return (T*)0; } \n"); //$NON-NLS-1$
try {
parse(writer.toString());
} catch (Throwable e) {
assertTrue( e instanceof AssertionFailedError );
}
// Iterator i = parse(writer.toString()).getDeclarations();
// IASTTemplateDeclaration td = (IASTTemplateDeclaration) i.next();
// IASTClassSpecifier cs = (IASTClassSpecifier) td.getOwnedDeclaration();
// Iterator j = cs.getDeclarations();
// IASTTemplateDeclaration td2 = (IASTTemplateDeclaration) j.next();
// assertFalse(j.hasNext());
// IASTMethod mdec = (IASTMethod) td2.getOwnedDeclaration();
// IASTTemplateDeclaration td3 = (IASTTemplateDeclaration) i.next();
// assertFalse(i.hasNext());
// IASTMethod mdef = (IASTMethod) td3.getOwnedDeclaration();
}
public void testGNUExternalTemplate_bug71603() throws Exception {
try {

View file

@ -17,6 +17,8 @@ import java.io.StringWriter;
import java.io.Writer;
import java.util.Iterator;
import junit.framework.AssertionFailedError;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
@ -1068,4 +1070,27 @@ public class CompleteParseASTTemplateTest extends CompleteParseBaseTest {
IASTTemplateDeclaration tmd = (IASTTemplateDeclaration) j.next();
assertFalse(j.hasNext());
}
public void testTemplateFunctionInsideTemplateType_bug71588() throws Exception {
StringWriter writer = new StringWriter();
writer.write("template <typename T, typename U> \r\n"); //$NON-NLS-1$
writer.write("class A { \n"); //$NON-NLS-1$
writer.write("template <typename V> \n"); //$NON-NLS-1$
writer.write("T* foo(V); \n"); //$NON-NLS-1$
writer.write("}; \n"); //$NON-NLS-1$
writer.write("template <typename T, typename U> \n"); //$NON-NLS-1$
writer.write("template <typename V> \n"); //$NON-NLS-1$
writer.write("T* A<T, U>::foo(V) { return (T*)0; } \n"); //$NON-NLS-1$
Iterator i = parse(writer.toString()).getDeclarations();
IASTTemplateDeclaration td = (IASTTemplateDeclaration) i.next();
IASTClassSpecifier cs = (IASTClassSpecifier) td.getOwnedDeclaration();
Iterator j = cs.getDeclarations();
IASTTemplateDeclaration td2 = (IASTTemplateDeclaration) j.next();
assertFalse(j.hasNext());
IASTMethod mdec = (IASTMethod) td2.getOwnedDeclaration();
IASTTemplateDeclaration td3 = (IASTTemplateDeclaration) i.next();
assertFalse(i.hasNext());
IASTMethod mdef = (IASTMethod) td3.getOwnedDeclaration();
}
}