JavaCompilerCore/test/parser/GeneralParserTest.java
JanUlrich 6fc412d949 Revert "Merge branch 'bytecode'"
This reverts commit 711c0d2f79, reversing
changes made to 2b47b8e5bf.
2015-05-12 19:54:34 +02:00

55 lines
1.4 KiB
Java

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 de.dhbwstuttgart.logger.LoggerConfiguration;
import de.dhbwstuttgart.logger.Section;
import de.dhbwstuttgart.typeinference.Menge;
import junit.framework.TestCase;
import org.junit.Test;
import de.dhbwstuttgart.core.MyCompiler;
import de.dhbwstuttgart.core.MyCompilerAPI;
/**
* 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(){
LoggerConfiguration config = new LoggerConfiguration();
config.setOutput(Section.PARSER, System.out);
Menge<String> filenames = new Menge<String>();
filenames.add("FieldInitializationTest.jav");
filenames.add("ImportTest.jav");
filenames.add("BoundedParameter.jav");
filenames.add("GenericFieldVarTest.jav");
filenames.add("FieldVarTest.jav");
MyCompilerAPI compiler = MyCompiler.getAPI(config);
try{
for(String filename : filenames)
compiler.parse(new File(rootDirectory + filename));
}catch(Exception exc){
exc.printStackTrace();
fail();
}
assertTrue("Tests durchlaufen",filenames.size()>0);
}
}