From a4cc4cc3576db7158ae5a3e73feb1a2f7e9e5650 Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 30 Mar 2022 15:35:40 +0200 Subject: [PATCH] Move Parser Tests --- src/test/java/parser/GeneralParserTest.java | 16 +++++++++------- .../javFiles}/parser/AntlrTest.jav | 1 + .../javFiles}/parser/BoundedParameter.jav | 0 .../javFiles}/parser/CastTest.jav | 0 .../javFiles}/parser/ExtendsTest.jav | 0 .../javFiles}/parser/FeatherWeightJava.jav | 0 .../javFiles}/parser/FieldInitializationTest.jav | 0 .../javFiles}/parser/FieldVarTest.jav | 0 .../javFiles}/parser/GenericFieldVarTest.jav | 0 .../javFiles}/parser/ImportTest.jav | 0 .../javFiles}/parser/ImportTest2.jav | 0 .../javFiles}/parser/ImportTestGeneric.jav | 0 .../javFiles}/parser/NewTest.jav | 0 .../javFiles}/parser/OpratorTest.jav | 0 .../javFiles}/parser/PackageNameTest.jav | 0 .../javFiles}/parser/StatementsTest.jav | 0 .../javFiles}/parser/StructuralTypes.jav | 0 .../javFiles}/parser/WhileTest.jav | 0 18 files changed, 10 insertions(+), 7 deletions(-) rename src/test/{java => resources/javFiles}/parser/AntlrTest.jav (95%) rename src/test/{java => resources/javFiles}/parser/BoundedParameter.jav (100%) rename src/test/{java => resources/javFiles}/parser/CastTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/ExtendsTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/FeatherWeightJava.jav (100%) rename src/test/{java => resources/javFiles}/parser/FieldInitializationTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/FieldVarTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/GenericFieldVarTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/ImportTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/ImportTest2.jav (100%) rename src/test/{java => resources/javFiles}/parser/ImportTestGeneric.jav (100%) rename src/test/{java => resources/javFiles}/parser/NewTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/OpratorTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/PackageNameTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/StatementsTest.jav (100%) rename src/test/{java => resources/javFiles}/parser/StructuralTypes.jav (100%) rename src/test/{java => resources/javFiles}/parser/WhileTest.jav (100%) diff --git a/src/test/java/parser/GeneralParserTest.java b/src/test/java/parser/GeneralParserTest.java index 4e7d9868..c5d8b678 100644 --- a/src/test/java/parser/GeneralParserTest.java +++ b/src/test/java/parser/GeneralParserTest.java @@ -20,18 +20,17 @@ import org.junit.Test; * */ public class GeneralParserTest{ - private static final String rootDirectory = System.getProperty("user.dir")+"/test/parser/"; - @Test public void run(){ List filenames = new ArrayList(); + + filenames.add("javFiles/parser/NewTest.jav"); + //filenames.add("CastTest.jav"); /* - filenames.add("NewTest.jav"); filenames.add("FieldInitializationTest.jav"); filenames.add("ImportTest.jav"); - filenames.add("CastTest.jav"); filenames.add("StatementsTest.jav"); //filenames.add("Methods.jav"); filenames.add("ImportTestGeneric.jav"); @@ -40,11 +39,14 @@ public class GeneralParserTest{ //filenames.add("GenericFieldVarTest.jav"); filenames.add("FieldVarTest.jav"); filenames.add("StructuralTypes.jav"); + filenames.add("ExtendsTest.jav"); */ -// filenames.add("ExtendsTest.jav"); - filenames.add("PackageNameTest.jav"); + + //filenames.add("PackageNameTest.jav"); try{ - new JavaTXCompiler(filenames.stream().map(s -> new File(rootDirectory + s)).collect(Collectors.toList())); + for(String filename : filenames){ + new JavaTXCompiler(new File(Thread.currentThread().getContextClassLoader().getResource(filename).getPath())); + } }catch(Exception exc){ exc.printStackTrace(); fail(); diff --git a/src/test/java/parser/AntlrTest.jav b/src/test/resources/javFiles/parser/AntlrTest.jav similarity index 95% rename from src/test/java/parser/AntlrTest.jav rename to src/test/resources/javFiles/parser/AntlrTest.jav index 31ab067d..dc457d73 100644 --- a/src/test/java/parser/AntlrTest.jav +++ b/src/test/resources/javFiles/parser/AntlrTest.jav @@ -1,3 +1,4 @@ + class Test{ method(){ if(true)i++; diff --git a/src/test/java/parser/BoundedParameter.jav b/src/test/resources/javFiles/parser/BoundedParameter.jav similarity index 100% rename from src/test/java/parser/BoundedParameter.jav rename to src/test/resources/javFiles/parser/BoundedParameter.jav diff --git a/src/test/java/parser/CastTest.jav b/src/test/resources/javFiles/parser/CastTest.jav similarity index 100% rename from src/test/java/parser/CastTest.jav rename to src/test/resources/javFiles/parser/CastTest.jav diff --git a/src/test/java/parser/ExtendsTest.jav b/src/test/resources/javFiles/parser/ExtendsTest.jav similarity index 100% rename from src/test/java/parser/ExtendsTest.jav rename to src/test/resources/javFiles/parser/ExtendsTest.jav diff --git a/src/test/java/parser/FeatherWeightJava.jav b/src/test/resources/javFiles/parser/FeatherWeightJava.jav similarity index 100% rename from src/test/java/parser/FeatherWeightJava.jav rename to src/test/resources/javFiles/parser/FeatherWeightJava.jav diff --git a/src/test/java/parser/FieldInitializationTest.jav b/src/test/resources/javFiles/parser/FieldInitializationTest.jav similarity index 100% rename from src/test/java/parser/FieldInitializationTest.jav rename to src/test/resources/javFiles/parser/FieldInitializationTest.jav diff --git a/src/test/java/parser/FieldVarTest.jav b/src/test/resources/javFiles/parser/FieldVarTest.jav similarity index 100% rename from src/test/java/parser/FieldVarTest.jav rename to src/test/resources/javFiles/parser/FieldVarTest.jav diff --git a/src/test/java/parser/GenericFieldVarTest.jav b/src/test/resources/javFiles/parser/GenericFieldVarTest.jav similarity index 100% rename from src/test/java/parser/GenericFieldVarTest.jav rename to src/test/resources/javFiles/parser/GenericFieldVarTest.jav diff --git a/src/test/java/parser/ImportTest.jav b/src/test/resources/javFiles/parser/ImportTest.jav similarity index 100% rename from src/test/java/parser/ImportTest.jav rename to src/test/resources/javFiles/parser/ImportTest.jav diff --git a/src/test/java/parser/ImportTest2.jav b/src/test/resources/javFiles/parser/ImportTest2.jav similarity index 100% rename from src/test/java/parser/ImportTest2.jav rename to src/test/resources/javFiles/parser/ImportTest2.jav diff --git a/src/test/java/parser/ImportTestGeneric.jav b/src/test/resources/javFiles/parser/ImportTestGeneric.jav similarity index 100% rename from src/test/java/parser/ImportTestGeneric.jav rename to src/test/resources/javFiles/parser/ImportTestGeneric.jav diff --git a/src/test/java/parser/NewTest.jav b/src/test/resources/javFiles/parser/NewTest.jav similarity index 100% rename from src/test/java/parser/NewTest.jav rename to src/test/resources/javFiles/parser/NewTest.jav diff --git a/src/test/java/parser/OpratorTest.jav b/src/test/resources/javFiles/parser/OpratorTest.jav similarity index 100% rename from src/test/java/parser/OpratorTest.jav rename to src/test/resources/javFiles/parser/OpratorTest.jav diff --git a/src/test/java/parser/PackageNameTest.jav b/src/test/resources/javFiles/parser/PackageNameTest.jav similarity index 100% rename from src/test/java/parser/PackageNameTest.jav rename to src/test/resources/javFiles/parser/PackageNameTest.jav diff --git a/src/test/java/parser/StatementsTest.jav b/src/test/resources/javFiles/parser/StatementsTest.jav similarity index 100% rename from src/test/java/parser/StatementsTest.jav rename to src/test/resources/javFiles/parser/StatementsTest.jav diff --git a/src/test/java/parser/StructuralTypes.jav b/src/test/resources/javFiles/parser/StructuralTypes.jav similarity index 100% rename from src/test/java/parser/StructuralTypes.jav rename to src/test/resources/javFiles/parser/StructuralTypes.jav diff --git a/src/test/java/parser/WhileTest.jav b/src/test/resources/javFiles/parser/WhileTest.jav similarity index 100% rename from src/test/java/parser/WhileTest.jav rename to src/test/resources/javFiles/parser/WhileTest.jav