aboutsummaryrefslogtreecommitdiff
path: root/src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java
diff options
context:
space:
mode:
authortricktron <tgagnaux@gmail.com>2022-02-25 10:19:16 +0100
committerGitHub <noreply@github.com>2022-02-25 10:19:16 +0100
commitd852eb27823a53abb97366bae84ad0b806d6c748 (patch)
tree05345a77152410d3d8354e209108e7fd125080f6 /src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java
parent5dda097196baa60fc45bb4f300439d791ccb1130 (diff)
parent4ea98e2199fcabbb585c4eb9187b3f00d7197d39 (diff)
downloadfrege-gradle-plugin-d852eb27823a53abb97366bae84ad0b806d6c748.tar.gz
frege-gradle-plugin-d852eb27823a53abb97366bae84ad0b806d6c748.tar.bz2
frege-gradle-plugin-d852eb27823a53abb97366bae84ad0b806d6c748.zip
Merge pull request #26 from tricktron/f-only-compile-mainModule-and-replModule-files
Only Compile Specified Files if Specified
Diffstat (limited to 'src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java')
-rw-r--r--src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java b/src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java
index c4d5bad..9170547 100644
--- a/src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java
+++ b/src/functionalTest/java/ch/fhnw/thga/gradleplugins/RunFregeTaskFunctionalTest.java
@@ -7,6 +7,8 @@ import static ch.fhnw.thga.gradleplugins.SharedFunctionalTestLogic.createFregeSe
import static ch.fhnw.thga.gradleplugins.SharedFunctionalTestLogic.runAndFailGradleTask;
import static ch.fhnw.thga.gradleplugins.SharedFunctionalTestLogic.runGradleTask;
import static ch.fhnw.thga.gradleplugins.SharedFunctionalTestLogic.MINIMAL_BUILD_FILE_CONFIG;
+import static ch.fhnw.thga.gradleplugins.SharedFunctionalTestLogic.COMPLETION_FR;
+import static ch.fhnw.thga.gradleplugins.SharedFunctionalTestLogic.assertFileDoesNotExist;
import static org.gradle.testkit.runner.TaskOutcome.FAILED;
import static org.gradle.testkit.runner.TaskOutcome.SUCCESS;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -116,7 +118,46 @@ public class RunFregeTaskFunctionalTest
);
assertTrue(result.getOutput().contains("Frege rocks"));
}
+
+ @Test
+ void given_two_frege_files_then_only_the_specified_main_module_is_compiled(
+ @TempDir File testProjectDir)
+ throws Exception
+ {
+ Project project = FregeProjectBuilder
+ .builder()
+ .projectRoot(testProjectDir)
+ .buildFile(MINIMAL_BUILD_FILE_CONFIG)
+ .fregeSourceFiles(() -> Stream.of(MAIN_FR, COMPLETION_FR))
+ .build();
+
+ BuildResult result = runGradleTask(
+ testProjectDir,
+ RUN_FREGE_TASK_NAME,
+ "--mainModule=ch.fhnw.thga.Main");
+
+ assertTrue(
+ project
+ .getTasks()
+ .getByName(RUN_FREGE_TASK_NAME)
+ instanceof RunFregeTask
+ );
+ assertEquals(
+ SUCCESS,
+ result.task(":" + RUN_FREGE_TASK_NAME).getOutcome()
+ );
+ assertTrue(result.getOutput().contains("Frege rocks"));
+ assertFileDoesNotExist(
+ testProjectDir,
+ "build/classes/main/frege/ch/fhnw/thga/Completion.java"
+ );
+ assertFileDoesNotExist(
+ testProjectDir,
+ "build/classes/main/frege/ch/fhnw/thga/Completion.class"
+ );
+ }
}
+
@Nested
@IndicativeSentencesGeneration(
separator = " -> ",