From b53817cd366bdd15ec142fc880fe68c7e5ea00a1 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Wed, 18 Nov 2015 23:36:21 +0000 Subject: introduce frege-base plugin for basic frege functionality --- .../frege/plugin/FregePluginIntegTest.groovy | 46 +++++++++++++++++----- 1 file changed, 37 insertions(+), 9 deletions(-) (limited to 'src/integTest/groovy') diff --git a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy index 5c985e8..a67620f 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,36 @@ 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"() { + given: + buildFile << """ dependencies { - compile "org.frege-lang:frege:3.22.367-g2737683" + compile "org.frege-lang:frege:$fregeVersion" } task sayHello(type: JavaExec){ classpath = sourceSets.main.runtimeClasspath main = 'HelloFrege' } - """ testProjectDir.newFolder("src", "main", "frege") @@ -65,6 +85,7 @@ main _ = do when: def result = GradleRunner.create() + .withGradleVersion(gradleVersion) .withProjectDir(testProjectDir.root) .withArguments('sayHello') .withPluginClasspath(pluginClasspath) @@ -73,5 +94,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 -- cgit From d47c934650540277c911514d4cf7ddf55a69492a Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Sat, 21 Nov 2015 00:59:06 +0000 Subject: create frege compile task per sourceSet --- .../groovy/frege/plugin/FregePluginIntegTest.groovy | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/integTest/groovy') diff --git a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy index a67620f..56c2eae 100644 --- a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy +++ b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy @@ -58,7 +58,7 @@ class FregePluginIntegTest extends Specification { } @Unroll - def "can compile and run frege code"() { + def "can compile and run frege code (gradle: #gradleVersion, frege: #fregeVersion)"() { given: buildFile << """ dependencies { @@ -66,6 +66,9 @@ class FregePluginIntegTest extends Specification { } task sayHello(type: JavaExec){ + doFirst { + println classpath.files + } classpath = sourceSets.main.runtimeClasspath main = 'HelloFrege' } @@ -86,8 +89,8 @@ main _ = do when: def result = GradleRunner.create() .withGradleVersion(gradleVersion) - .withProjectDir(testProjectDir.root) - .withArguments('sayHello') + .withDebug(true).withProjectDir(testProjectDir.root) + .withArguments('sayHello', '--stacktrace', '-i') .withPluginClasspath(pluginClasspath) .build() @@ -98,8 +101,8 @@ main _ = do 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" +// DEFAULT_FREGE_VERSION | "2.8" +// "3.22.367-g2737683" | "2.9" +// "3.22.367-g2737683" | "2.8" } } \ No newline at end of file -- cgit From 06b6bfbfd1b1f62d191c494d093fae637e144a7a Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Sat, 21 Nov 2015 01:07:39 +0000 Subject: some integTest cleanup + more test coverage --- src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/integTest/groovy') diff --git a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy index 56c2eae..547c939 100644 --- a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy +++ b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy @@ -90,7 +90,7 @@ main _ = do def result = GradleRunner.create() .withGradleVersion(gradleVersion) .withDebug(true).withProjectDir(testProjectDir.root) - .withArguments('sayHello', '--stacktrace', '-i') + .withArguments('sayHello') .withPluginClasspath(pluginClasspath) .build() @@ -101,8 +101,8 @@ main _ = do 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" + DEFAULT_FREGE_VERSION | "2.8" + "3.22.367-g2737683" | "2.9" + "3.22.367-g2737683" | "2.8" } } \ No newline at end of file -- cgit From 73dd702743a5b4d8816e495e55c19f391669fc25 Mon Sep 17 00:00:00 2001 From: Rene Groeschke Date: Sat, 21 Nov 2015 01:09:13 +0000 Subject: some integTest cleanup + more test coverage --- src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/integTest/groovy') diff --git a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy index 547c939..b6936a8 100644 --- a/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy +++ b/src/integTest/groovy/frege/plugin/FregePluginIntegTest.groovy @@ -89,7 +89,7 @@ main _ = do when: def result = GradleRunner.create() .withGradleVersion(gradleVersion) - .withDebug(true).withProjectDir(testProjectDir.root) + .withProjectDir(testProjectDir.root) .withArguments('sayHello') .withPluginClasspath(pluginClasspath) .build() -- cgit