Add test to the scripting fixes for maven plugin

tests KT-34011 and KT-34006 fixes
This commit is contained in:
Ilya Chernikov
2019-09-25 21:56:46 +02:00
parent 517e5e8954
commit 3430a21fa1
4 changed files with 111 additions and 0 deletions
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>test-helloworld</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-script-runtime</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
</plugins>
</pluginManagement>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<plugins>
<plugin> <artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>process-test-sources</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<!-- <configuration>-->
<!-- <args>-->
<!-- <arg>-Xplugin=/Users/lige/Work/kotlin/kotlin/dist/kotlinc/lib/kotlin-scripting-compiler.jar</arg>-->
<!-- <arg>-Xplugin=/Users/lige/Work/kotlin/kotlin/dist/kotlinc/lib/kotlin-scripting-compiler-impl.jar</arg>-->
<!-- <arg>-Xplugin=/Users/lige/Work/kotlin/kotlin/dist/kotlinc/lib/kotlin-scripting-common.jar</arg>-->
<!-- <arg>-Xplugin=/Users/lige/Work/kotlin/kotlin/dist/kotlinc/lib/kotlin-scripting-jvm.jar</arg>-->
<!-- </args>-->
<!-- </configuration>-->
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,8 @@
package org.jetbrains
fun getGreeting() : String {
return "Hello, World!"
}
System.out?.println(getGreeting())
@@ -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());
}
}
@@ -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);
}