Parser tests angefügt
This commit is contained in:
parent
dbda805fa5
commit
75f9a74c44
3
test/parser/FieldInitializationTest.jav
Normal file
3
test/parser/FieldInitializationTest.jav
Normal file
@ -0,0 +1,3 @@
|
||||
class FieldInitializationTest{
|
||||
String var = "hallo";
|
||||
}
|
43
test/parser/GeneralParserTest.java
Normal file
43
test/parser/GeneralParserTest.java
Normal file
@ -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<String> filenames = new Vector<String>();
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user