mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch for Andrew Niefer:
Added DomFailedTest::testBug36769 Added DomFailedTest::testBug36771 Fixed AutomatedTest to handle files with commas in their names Added ScannerTestCase::testBug36770
This commit is contained in:
parent
51243d8162
commit
dce8a1d011
3 changed files with 96 additions and 1 deletions
|
@ -0,0 +1,78 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2003 IBM Corporation and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v0.5
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v05.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corp. - Rational Software - initial implementation
|
||||||
|
******************************************************************************/
|
||||||
|
package org.eclipse.cdt.core.parser.failedTests;
|
||||||
|
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.parser.tests.DOMTests;
|
||||||
|
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
|
||||||
|
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author aniefer
|
||||||
|
*
|
||||||
|
* To change the template for this generated type comment go to
|
||||||
|
* Window>Preferences>Java>Code Generation>Code and Comments
|
||||||
|
*/
|
||||||
|
public class ACEFailedTest extends DOMTests {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param arg
|
||||||
|
*/
|
||||||
|
public ACEFailedTest(String arg) {
|
||||||
|
super(arg);
|
||||||
|
}
|
||||||
|
public static Test suite() {
|
||||||
|
TestSuite suite = new TestSuite();
|
||||||
|
|
||||||
|
suite.addTest(new ACEFailedTest("testBug36769"));
|
||||||
|
suite.addTest(new ACEFailedTest("testBug36771"));
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug36771(){
|
||||||
|
boolean testPassed = false;
|
||||||
|
try{
|
||||||
|
Writer code = new StringWriter();
|
||||||
|
code.write("#include /**/ \"foo.h\"\n");
|
||||||
|
TranslationUnit tu = parse( code.toString());
|
||||||
|
testPassed = true;
|
||||||
|
} catch( Throwable e ){
|
||||||
|
if( ! (e instanceof ParserException))
|
||||||
|
fail( "Unexpected Error: " + e.getMessage() );
|
||||||
|
}
|
||||||
|
if( testPassed )
|
||||||
|
fail( "The expected error did not occur.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug36769(){
|
||||||
|
boolean testPassed = false;
|
||||||
|
try{
|
||||||
|
Writer code = new StringWriter();
|
||||||
|
code.write("template <class A, B> cls<A, C>::operator op &() const {}\n");
|
||||||
|
code.write("template <class A, B> cls<A, C>::cls() {}\n");
|
||||||
|
code.write("template <class A, B> cls<A, C>::~cls() {}\n");
|
||||||
|
|
||||||
|
TranslationUnit tu = parse( code.toString());
|
||||||
|
testPassed = true;
|
||||||
|
} catch( Throwable e ){
|
||||||
|
if( ! (e instanceof ParserException))
|
||||||
|
fail( "Unexpected Error: " + e.getMessage() );
|
||||||
|
}
|
||||||
|
if( testPassed )
|
||||||
|
fail( "The expected error did not occur.");
|
||||||
|
}
|
||||||
|
}
|
|
@ -187,7 +187,7 @@ public class AutomatedTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
fileList.add( file );
|
fileList.add( file );
|
||||||
suite.addTest( new AutomatedTest( file.getName() ) );
|
suite.addTest( new AutomatedTest( file.getName().replaceAll(",", "_") ) );
|
||||||
}
|
}
|
||||||
file = files[ i++ ];
|
file = files[ i++ ];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1416,4 +1416,21 @@ public class ScannerTestCase extends TestCase
|
||||||
validateToken(Token.tRPAREN);
|
validateToken(Token.tRPAREN);
|
||||||
validateToken(Token.tSEMI);
|
validateToken(Token.tSEMI);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug36770() throws Exception
|
||||||
|
{
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
writer.write( "#define A 0\n" );
|
||||||
|
writer.write( "#if ( A == 1 )\n");
|
||||||
|
writer.write( "# define foo 1\n");
|
||||||
|
writer.write( "#else\n");
|
||||||
|
writer.write( "# define foo 2\n");
|
||||||
|
writer.write( "#endif\n");
|
||||||
|
writer.write( "foo\n");
|
||||||
|
|
||||||
|
initializeScanner( writer.toString() );
|
||||||
|
validateInteger( "2" );
|
||||||
|
validateEOF();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue