diff --git a/test/parser/FieldInitializationTest.jav b/test/parser/FieldInitializationTest.jav new file mode 100644 index 000000000..302667b97 --- /dev/null +++ b/test/parser/FieldInitializationTest.jav @@ -0,0 +1,3 @@ +class FieldInitializationTest{ + String var = "hallo"; +} \ No newline at end of file diff --git a/test/parser/GeneralParserTest.java b/test/parser/GeneralParserTest.java new file mode 100644 index 000000000..4a9d245b4 --- /dev/null +++ b/test/parser/GeneralParserTest.java @@ -0,0 +1,43 @@ +package parser; + +import static org.junit.Assert.*; + +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Vector; + +import junit.framework.TestCase; +import mycompiler.MyCompiler; +import mycompiler.MyCompilerAPI; + +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{ + private static final String rootDirectory = System.getProperty("user.dir")+"/test/parser/"; + + @Test + public void run(){ + Vector filenames = new Vector(); + filenames.add("FieldInitializationTest.jav"); + MyCompilerAPI compiler = MyCompiler.getAPI(); + try{ + for(String filename : filenames) + compiler.parse(new File(rootDirectory + filename)); + }catch(Exception exc){ + exc.printStackTrace(); + fail(); + } + assertTrue("Tests durchlaufen",filenames.size()>0); + } + +}