summaryrefslogtreecommitdiff
path: root/plugin/src/functionalTest
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/src/functionalTest')
-rw-r--r--plugin/src/functionalTest/kotlin/moe/nea/archenemy/ArchenemyPluginFunctionalTest.kt44
1 files changed, 44 insertions, 0 deletions
diff --git a/plugin/src/functionalTest/kotlin/moe/nea/archenemy/ArchenemyPluginFunctionalTest.kt b/plugin/src/functionalTest/kotlin/moe/nea/archenemy/ArchenemyPluginFunctionalTest.kt
new file mode 100644
index 0000000..c4ba495
--- /dev/null
+++ b/plugin/src/functionalTest/kotlin/moe/nea/archenemy/ArchenemyPluginFunctionalTest.kt
@@ -0,0 +1,44 @@
+/*
+ * This Kotlin source file was generated by the Gradle 'init' task.
+ */
+package moe.nea.archenemy
+
+import java.io.File
+import java.nio.file.Files
+import kotlin.test.assertTrue
+import kotlin.test.Test
+import org.gradle.testkit.runner.GradleRunner
+import org.junit.Rule
+import org.junit.rules.TemporaryFolder
+
+/**
+ * A simple functional test for the 'moe.nea.archenemy.greeting' plugin.
+ */
+class ArchenemyPluginFunctionalTest {
+ @get:Rule val tempFolder = TemporaryFolder()
+
+ private fun getProjectDir() = tempFolder.root
+ private fun getBuildFile() = getProjectDir().resolve("build.gradle")
+ private fun getSettingsFile() = getProjectDir().resolve("settings.gradle")
+
+ @Test fun `can run task`() {
+ // Setup the test build
+ getSettingsFile().writeText("")
+ getBuildFile().writeText("""
+plugins {
+ id('moe.nea.archenemy.greeting')
+}
+""")
+
+ // Run the build
+ val runner = GradleRunner.create()
+ runner.forwardOutput()
+ runner.withPluginClasspath()
+ runner.withArguments("greeting")
+ runner.withProjectDir(getProjectDir())
+ val result = runner.build();
+
+ // Verify the result
+ assertTrue(result.output.contains("Hello from plugin 'moe.nea.archenemy.greeting'"))
+ }
+}