diff options
author | Dierk König <dierk.koenig@canoo.com> | 2015-11-21 10:09:31 +0100 |
---|---|---|
committer | Dierk König <dierk.koenig@canoo.com> | 2015-11-21 10:09:31 +0100 |
commit | f0807811f48c50b6a5fe7816ef48c148be9f9903 (patch) | |
tree | c61df925b637d26c95086510ee471ac861a36731 /src/integTest | |
parent | fa6dce676590c83bc84d130e1241cf585f88a469 (diff) | |
parent | 73dd702743a5b4d8816e495e55c19f391669fc25 (diff) | |
download | frege-gradle-plugin-f0807811f48c50b6a5fe7816ef48c148be9f9903.tar.gz frege-gradle-plugin-f0807811f48c50b6a5fe7816ef48c148be9f9903.tar.bz2 frege-gradle-plugin-f0807811f48c50b6a5fe7816ef48c148be9f9903.zip |
Merge pull request #28 from breskeby/base-plugin
Base plugin
Diffstat (limited to 'src/integTest')
-rw-r--r-- | src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy | 49 |
1 files changed, 40 insertions, 9 deletions
diff --git a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy index 5c985e8..b6936a8 100644 --- a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy +++ b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy @@ -1,14 +1,15 @@ package frege.plugin - import org.gradle.testkit.runner.GradleRunner import org.junit.Rule import org.junit.rules.TemporaryFolder import spock.lang.Specification +import spock.lang.Unroll import static org.gradle.testkit.runner.TaskOutcome.SUCCESS class FregePluginIntegTest extends Specification { + public static final String DEFAULT_FREGE_VERSION = "3.23.370-g898bc8c" @Rule final TemporaryFolder testProjectDir = new TemporaryFolder() File buildFile @@ -18,6 +19,15 @@ class FregePluginIntegTest extends Specification { def setup() { buildFile = testProjectDir.newFile('build.gradle') + buildFile << """ + plugins { + id 'org.frege-lang' + } + + repositories { + jcenter() + } + """ def pluginClasspathResource = getClass().classLoader.findResource("plugin-classpath.txt") if (pluginClasspathResource == null) { // try again via file reference @@ -29,26 +39,39 @@ class FregePluginIntegTest extends Specification { pluginClasspath = pluginClasspathResource.readLines().collect { new File(it) } } - def "can compile frege production code"() { + def "can handle non existing source directories"() { given: buildFile << """ - plugins { - id 'org.frege-lang' + dependencies { + compile "org.frege-lang:frege:$DEFAULT_FREGE_VERSION" } + """ - repositories { - jcenter() - } + when: + def result = GradleRunner.create() + .withProjectDir(testProjectDir.root) + .withArguments('classes') + .withPluginClasspath(pluginClasspath) + .build() + then: + result.task(":compileFrege") != null + } + @Unroll + def "can compile and run frege code (gradle: #gradleVersion, frege: #fregeVersion)"() { + given: + buildFile << """ dependencies { - compile "org.frege-lang:frege:3.22.367-g2737683" + compile "org.frege-lang:frege:$fregeVersion" } task sayHello(type: JavaExec){ + doFirst { + println classpath.files + } classpath = sourceSets.main.runtimeClasspath main = 'HelloFrege' } - """ testProjectDir.newFolder("src", "main", "frege") @@ -65,6 +88,7 @@ main _ = do when: def result = GradleRunner.create() + .withGradleVersion(gradleVersion) .withProjectDir(testProjectDir.root) .withArguments('sayHello') .withPluginClasspath(pluginClasspath) @@ -73,5 +97,12 @@ main _ = do then: result.output.contains("Hello Frege!") result.task(":sayHello").outcome == SUCCESS + + where: + fregeVersion | gradleVersion + DEFAULT_FREGE_VERSION | "2.9" + DEFAULT_FREGE_VERSION | "2.8" + "3.22.367-g2737683" | "2.9" + "3.22.367-g2737683" | "2.8" } }
\ No newline at end of file |