blob: c4ba495ff43fd4195dff147faf4fee11fac1f787 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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'"))
}
}
|