aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortricktron <tgagnaux@gmail.com>2022-04-06 14:44:38 +0200
committerGitHub <noreply@github.com>2022-04-06 14:44:38 +0200
commit56a7af2bb5f1eaf09c2c5ad8ea81c6f402a98725 (patch)
tree2c2e2763ba7164fe36080c27eef950d46b96adea
parent0977993321884fdb4ab14f9cbcb3602e120bfdc5 (diff)
parentc2fda93343d5c12821502741d1c1c65cdbb157ee (diff)
downloadfrege-gradle-plugin-56a7af2bb5f1eaf09c2c5ad8ea81c6f402a98725.tar.gz
frege-gradle-plugin-56a7af2bb5f1eaf09c2c5ad8ea81c6f402a98725.tar.bz2
frege-gradle-plugin-56a7af2bb5f1eaf09c2c5ad8ea81c6f402a98725.zip
Merge pull request #33 from tricktron/f-dependent-frege-files-with-wrong-source-path
Frege Compiler Make Mode Test
-rw-r--r--gradle.properties2
-rw-r--r--src/functionalTest/java/ch/fhnw/thga/gradleplugins/CompileFregeTaskFunctionalTest.java64
2 files changed, 65 insertions, 1 deletions
diff --git a/gradle.properties b/gradle.properties
index 2ee2100..b933247 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,2 @@
group = ch.fhnw.thga
-version = 2.0.1-alpha \ No newline at end of file
+version = 2.0.2-alpha \ No newline at end of file
diff --git a/src/functionalTest/java/ch/fhnw/thga/gradleplugins/CompileFregeTaskFunctionalTest.java b/src/functionalTest/java/ch/fhnw/thga/gradleplugins/CompileFregeTaskFunctionalTest.java
index 642f958..0dfc8dc 100644
--- a/src/functionalTest/java/ch/fhnw/thga/gradleplugins/CompileFregeTaskFunctionalTest.java
+++ b/src/functionalTest/java/ch/fhnw/thga/gradleplugins/CompileFregeTaskFunctionalTest.java
@@ -72,6 +72,7 @@ public class CompileFregeTaskFunctionalTest
"build/classes/main/frege/ch/fhnw/thga/Completion.class"
);
}
+
@Test
void given_frege_code_and_many_compiler_flags(
@TempDir File testProjectDir)
@@ -113,6 +114,7 @@ public class CompileFregeTaskFunctionalTest
"build/classes/main/frege/ch/fhnw/thga/Completion.class"
);
}
+
@Test
void given_frege_code_in_custom_source_and_output_dir_and_minimal_build_file_config(
@TempDir File testProjectDir)
@@ -156,6 +158,7 @@ public class CompileFregeTaskFunctionalTest
"build/frege/ch/fhnw/thga/Completion.class"
);
}
+
@Test
void and_is_up_to_date_given_no_code_changes(
@TempDir File testProjectDir)
@@ -180,6 +183,7 @@ public class CompileFregeTaskFunctionalTest
UP_TO_DATE,
second.task(":" + COMPILE_FREGE_TASK_NAME).getOutcome());
}
+
@Test
void and_is_cached_given_cache_hit(
@TempDir File testProjectDir)
@@ -249,6 +253,7 @@ public class CompileFregeTaskFunctionalTest
FROM_CACHE,
third.task(":" + COMPILE_FREGE_TASK_NAME).getOutcome());
}
+
@Test
void given_two_dependent_frege_files_in_default_source_dir_and_minimal_build_file_config(
@TempDir File testProjectDir)
@@ -264,6 +269,7 @@ public class CompileFregeTaskFunctionalTest
"frob i = complete $ i + i",
NEW_LINE
);
+
Project project = FregeProjectBuilder
.builder()
.projectRoot(testProjectDir)
@@ -311,6 +317,7 @@ public class CompileFregeTaskFunctionalTest
);
}
}
+
@Nested
@IndicativeSentencesGeneration(
separator = " -> ",
@@ -351,6 +358,7 @@ public class CompileFregeTaskFunctionalTest
result.task(":" + COMPILE_FREGE_TASK_NAME).getOutcome()
);
}
+
@Test
void given_two_dependent_frege_files_in_default_source_dir_and_without_make_compiler_flag(
@TempDir File testProjectDir)
@@ -404,5 +412,61 @@ public class CompileFregeTaskFunctionalTest
result.task(":" + COMPILE_FREGE_TASK_NAME).getOutcome()
);
}
+
+ @Test
+ void given_wrong_main_source_dir_when_searching_for_dependent_frege_module(
+ @TempDir File testProjectDir)
+ throws Exception
+ {
+ String codeImportingDependentModule = String.join(
+ NEW_LINE,
+ "module ch.fhnw.thga.Frob where",
+ NEW_LINE,
+ NEW_LINE,
+ "import ch.fhnw.thga.Completion (complete)",
+ NEW_LINE,
+ "frob i = complete $ i + i",
+ NEW_LINE
+ );
+
+ String wrongMainSourceDirBuildFileConfig = createFregeSection(
+ FregeDTOBuilder
+ .builder()
+ .version("'3.25.84'")
+ .release("'3.25alpha'")
+ .mainSourceDir("layout.projectDirectory")
+ .build()
+ );
+
+ Project project = FregeProjectBuilder
+ .builder()
+ .projectRoot(testProjectDir)
+ .buildFile(wrongMainSourceDirBuildFileConfig)
+ .fregeSourceFiles(() -> Stream.of(COMPLETION_FR, new FregeSourceFile(
+ String.format(
+ "%s/%s",
+ DEFAULT_RELATIVE_SOURCE_DIR,
+ "ch/fhnw/thga/Frob.fr"
+ ),
+ codeImportingDependentModule)))
+ .build();
+
+ BuildResult result = runAndFailGradleTask(
+ testProjectDir,
+ COMPILE_FREGE_TASK_NAME,
+ "--compileItem=ch.fhnw.thga.Frob"
+ );
+
+ assertTrue(
+ project
+ .getTasks()
+ .getByName(COMPILE_FREGE_TASK_NAME)
+ instanceof CompileFregeTask
+ );
+ assertEquals(
+ FAILED,
+ result.task(":" + COMPILE_FREGE_TASK_NAME).getOutcome()
+ );
+ }
}
}