forked from JavaTX/JavaCompilerCore
Neuen Test für new Statement
This commit is contained in:
parent
752f59172f
commit
b0ef4aecd6
@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="test"/>
|
<classpathentry kind="src" path="test"/>
|
||||||
<classpathentry kind="lib" path="lib/bcel-6.1-SNAPSHOT.jar" sourcepath="lib/bcel-6.1-SNAPSHOT-sources.jar"/>
|
<classpathentry kind="lib" path="lib/bcel-6.1-SNAPSHOT.jar" sourcepath="lib/bcel-6.1-SNAPSHOT-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/guava-10.0.1.jar"/>
|
<classpathentry kind="lib" path="lib/guava-10.0.1.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
|
||||||
<classpathentry kind="lib" path="lib/antlr-complete.jar"/>
|
<classpathentry kind="lib" path="lib/antlr-complete.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/reflections-0.9.10-javadoc.jar"/>
|
<classpathentry kind="lib" path="lib/reflections-0.9.10-javadoc.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/reflections-0.9.10-sources.jar"/>
|
<classpathentry kind="lib" path="lib/reflections-0.9.10-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/reflections-0.9.10.jar"/>
|
<classpathentry kind="lib" path="lib/reflections-0.9.10.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -210,7 +210,7 @@ public class SyntaxTreeGenerator{
|
|||||||
if(ctx.superclass() != null){
|
if(ctx.superclass() != null){
|
||||||
superClass = convert(ctx.superclass());
|
superClass = convert(ctx.superclass());
|
||||||
}else{
|
}else{
|
||||||
superClass = new ASTFactory(reg).createObjectClass().getType();
|
superClass = new RefType(new JavaClassName("java.lang.Object"), new NullToken());
|
||||||
}
|
}
|
||||||
Boolean isInterface = false;
|
Boolean isInterface = false;
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> implementedInterfaces = null;
|
List<RefTypeOrTPHOrWildcardOrGeneric> implementedInterfaces = null;
|
||||||
|
@ -5,7 +5,6 @@ import static org.junit.Assert.*;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.dhbwstuttgart.parser.JavaTXParser;
|
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||||
import de.dhbwstuttgart.strucTypes.AS_Abstract;
|
import de.dhbwstuttgart.strucTypes.AS_Abstract;
|
||||||
import de.dhbwstuttgart.strucTypes.TC_Abstract;
|
import de.dhbwstuttgart.strucTypes.TC_Abstract;
|
||||||
@ -13,6 +12,7 @@ import de.dhbwstuttgart.strucTypes.Algo_Type;
|
|||||||
import de.dhbwstuttgart.strucTypes.Algo_TypeExpr;
|
import de.dhbwstuttgart.strucTypes.Algo_TypeExpr;
|
||||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||||
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
|
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
|
||||||
|
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -41,8 +41,8 @@ public class GeneralParserTest{
|
|||||||
//filenames.add("GenericFieldVarTest.jav");
|
//filenames.add("GenericFieldVarTest.jav");
|
||||||
//filenames.add("FieldVarTest.jav");
|
//filenames.add("FieldVarTest.jav");
|
||||||
|
|
||||||
//filenames.add("StructuralTypesField.jav");
|
filenames.add("StructuralTypesField.jav");
|
||||||
filenames.add("StructuralTypesSimple3.jav");
|
//filenames.add("Main.jav");
|
||||||
|
|
||||||
JavaTXParser parser = new JavaTXParser();
|
JavaTXParser parser = new JavaTXParser();
|
||||||
try{
|
try{
|
||||||
@ -60,15 +60,17 @@ public class GeneralParserTest{
|
|||||||
|
|
||||||
|
|
||||||
// Print der Expression:
|
// Print der Expression:
|
||||||
System.out.println(Algo_TypeExpr.expression2code(ass, sf.getClasses().get(0).getMethods().get(0).get_Block().statements));
|
//System.out.println(Algo_TypeExpr.expression2code(ass, sf.getClasses().get(0).getMethods().get(0).get_Block().statements));
|
||||||
System.out.println(Algo_TypeExpr.expression2code(ass, sf.getClasses().get(0).getMethods().get(2).get_Block().statements));
|
//System.out.println(Algo_TypeExpr.expression2code(ass, sf.getClasses().get(0).getMethods().get(2).get_Block().statements));
|
||||||
|
|
||||||
|
|
||||||
// Erstellen der TypeExpression
|
// Erstellen der TypeExpression
|
||||||
|
|
||||||
|
|
||||||
|
// Wegen java Build path
|
||||||
|
if (false) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
70
test/strucTypes/GeneralParserTest_Main.java
Normal file
70
test/strucTypes/GeneralParserTest_Main.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package strucTypes;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||||
|
import de.dhbwstuttgart.strucTypes.AS_Abstract;
|
||||||
|
import de.dhbwstuttgart.strucTypes.TC_Abstract;
|
||||||
|
import de.dhbwstuttgart.strucTypes.Algo_Type;
|
||||||
|
import de.dhbwstuttgart.strucTypes.Algo_TypeExpr;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||||
|
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dieser Test pr�ft nur, ob .java-Dateien fehlerfrei geparst werden.
|
||||||
|
* Der dabei erstellte Syntaxbaum wird nicht kontrolliert.
|
||||||
|
* @author janulrich
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GeneralParserTest_Main{
|
||||||
|
private static final String rootDirectory = System.getProperty("user.dir")+"/test/strucTypes/";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void run(){
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Auflistung aller Files die getestet werden sollen
|
||||||
|
*/
|
||||||
|
List<String> filenames = new ArrayList<String>();
|
||||||
|
//filenames.add("FieldInitializationTest.jav");
|
||||||
|
//filenames.add("ImportTest.jav");
|
||||||
|
//filenames.add("StatementsTest.jav");
|
||||||
|
//filenames.add("ImportTestGeneric.jav");
|
||||||
|
//filenames.add("BoundedParameter.jav");
|
||||||
|
//filenames.add("GenericFieldVarTest.jav");
|
||||||
|
//filenames.add("FieldVarTest.jav");
|
||||||
|
|
||||||
|
//filenames.add("StructuralTypesField.jav");
|
||||||
|
filenames.add("Main.jav");
|
||||||
|
|
||||||
|
JavaTXParser parser = new JavaTXParser();
|
||||||
|
try{
|
||||||
|
for(String filename : filenames) {
|
||||||
|
|
||||||
|
System.out.println("Teste: "+ filename);
|
||||||
|
|
||||||
|
SourceFile sf = parser.parse(new File(rootDirectory + filename));
|
||||||
|
|
||||||
|
SourceFile sfdebug = sf;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch(Exception exc){
|
||||||
|
exc.printStackTrace();
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
assertTrue("Tests durchlaufen",filenames.size()>0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
6
test/strucTypes/Main.jav
Normal file
6
test/strucTypes/Main.jav
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
class Main {
|
||||||
|
|
||||||
|
main() { return new A<>().mt(new myInteger(1)); }
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user