From 3430a21fa157df0cc819f0d8df0b21efa04db58f Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Wed, 25 Sep 2019 21:56:46 +0200 Subject: [PATCH] Add test to the scripting fixes for maven plugin tests KT-34011 and KT-34006 fixes --- .../src/it/test-helloworld-kts/pom.xml | 82 +++++++++++++++++++ .../main/kotlin/org/jetbrains/HelloWorld.kts | 8 ++ .../org/jetbrains/HelloWorldJavaTest.java | 15 ++++ .../src/it/test-helloworld-kts/verify.bsh | 6 ++ 4 files changed, 111 insertions(+) create mode 100644 libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/pom.xml create mode 100644 libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/main/kotlin/org/jetbrains/HelloWorld.kts create mode 100644 libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/test/java/org/jetbrains/HelloWorldJavaTest.java create mode 100644 libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/verify.bsh diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/pom.xml b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/pom.xml new file mode 100644 index 00000000000..ab53d4e1b77 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + org.jetbrains.kotlin + test-helloworld + 1.0-SNAPSHOT + + + + junit + junit + 4.9 + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-script-runtime + ${kotlin.version} + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.apache.maven.plugins + maven-source-plugin + 2.1.2 + + + + + ${project.basedir}/src/main/kotlin + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/main/kotlin/org/jetbrains/HelloWorld.kts b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/main/kotlin/org/jetbrains/HelloWorld.kts new file mode 100644 index 00000000000..31090b953cd --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/main/kotlin/org/jetbrains/HelloWorld.kts @@ -0,0 +1,8 @@ +package org.jetbrains + +fun getGreeting() : String { + return "Hello, World!" +} + +System.out?.println(getGreeting()) + diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/test/java/org/jetbrains/HelloWorldJavaTest.java b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/test/java/org/jetbrains/HelloWorldJavaTest.java new file mode 100644 index 00000000000..baf6d28c3dd --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/src/test/java/org/jetbrains/HelloWorldJavaTest.java @@ -0,0 +1,15 @@ +package org.jetbrains; + +import org.junit.Test; + +import static junit.framework.Assert.assertEquals; + +public class HelloWorldJavaTest { + + @Test + public void greeting() { + String[] args = {}; + org.jetbrains.HelloWorld hw = new org.jetbrains.HelloWorld(args); + assertEquals("Hello, World!", hw.getGreeting()); + } +} diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/verify.bsh b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/verify.bsh new file mode 100644 index 00000000000..11ef47ff8d7 --- /dev/null +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-helloworld-kts/verify.bsh @@ -0,0 +1,6 @@ +import java.io.*; + +File file = new File(basedir, "target/test-helloworld-1.0-SNAPSHOT.jar"); +if (!file.exists() || !file.isFile()) { + throw new FileNotFoundException("Could not find generated JAR: " + file); +}