Skip to content

Commit

Permalink
test: improve MainTest (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky authored and monperrus committed Jul 1, 2018
1 parent bf66d6e commit 79fe3a6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/test/java/spoon/test/main/MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.junit.contrib.java.lang.system.Assertion;
import org.junit.contrib.java.lang.system.ExpectedSystemExit;
import spoon.Launcher;
import spoon.SpoonModelBuilder.InputType;
import spoon.reflect.code.CtArrayWrite;
import spoon.reflect.code.CtAssignment;
import spoon.reflect.code.CtExpression;
Expand Down Expand Up @@ -86,7 +87,7 @@ public static void loadModel() {

launcher = new Launcher();

launcher.run(new String[] {
launcher.setArgs(new String[] {
"-i", "src/main/java",
"-o", "target/spooned",
"--destination","target/spooned-build",
Expand All @@ -96,9 +97,19 @@ public static void loadModel() {
"--level", "OFF"
});

launcher.buildModel();

rootPackage = launcher.getFactory().Package().getRootPackage();
}

@Test
public void testMain_ModelPrintAndCompile() {
//contract: check that spoon sources can be printed
launcher.prettyprint();
//contract: check that spoon sources can be compiled
launcher.getModelBuilder().compile(InputType.CTTYPES);
}

@Test
public void testMain_checkGenericContracts() {
checkGenericContracts(rootPackage);
Expand Down

0 comments on commit 79fe3a6

Please sign in to comment.