kotlin.test: Rename jvm module to junit
This commit is contained in:
Generated
+13
@@ -0,0 +1,13 @@
|
|||||||
|
<component name="libraryTable">
|
||||||
|
<library name="kotlin-test">
|
||||||
|
<CLASSES>
|
||||||
|
<root url="jar://$PROJECT_DIR$/dependencies/bootstrap-compiler/Kotlin/kotlinc/lib/kotlin-test.jar!/" />
|
||||||
|
</CLASSES>
|
||||||
|
<JAVADOC />
|
||||||
|
<SOURCES>
|
||||||
|
<root url="file://$PROJECT_DIR$/libraries/kotlin.test/shared/src/main/kotlin" />
|
||||||
|
<root url="file://$PROJECT_DIR$/libraries/kotlin.test/shared/src/main/kotlin.jvm" />
|
||||||
|
<root url="file://$PROJECT_DIR$/libraries/kotlin.test/junit/src/main/kotlin" />
|
||||||
|
</SOURCES>
|
||||||
|
</library>
|
||||||
|
</component>
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
<property name="bootstrap.compiler.home" value="${bootstrap.home}/Kotlin/kotlinc"/>
|
<property name="bootstrap.compiler.home" value="${bootstrap.home}/Kotlin/kotlinc"/>
|
||||||
<property name="bootstrap.runtime" value="${bootstrap.compiler.home}/lib/kotlin-runtime.jar"/>
|
<property name="bootstrap.runtime" value="${bootstrap.compiler.home}/lib/kotlin-runtime.jar"/>
|
||||||
<property name="bootstrap.reflect" value="${bootstrap.compiler.home}/lib/kotlin-reflect.jar"/>
|
<property name="bootstrap.reflect" value="${bootstrap.compiler.home}/lib/kotlin-reflect.jar"/>
|
||||||
|
<property name="bootstrap.kotlin.test" value="${bootstrap.compiler.home}/lib/kotlin-test.jar" />
|
||||||
|
|
||||||
<property name="output" value="${basedir}/dist"/>
|
<property name="output" value="${basedir}/dist"/>
|
||||||
<property name="js.stdlib.output.dir" value="${output}/js"/>
|
<property name="js.stdlib.output.dir" value="${output}/js"/>
|
||||||
@@ -56,6 +57,7 @@
|
|||||||
|
|
||||||
<path id="classpath">
|
<path id="classpath">
|
||||||
<file file="${bootstrap.runtime}"/>
|
<file file="${bootstrap.runtime}"/>
|
||||||
|
<file file="${bootstrap.kotlin.test}" />
|
||||||
<file file="${bootstrap.reflect}"/>
|
<file file="${bootstrap.reflect}"/>
|
||||||
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
|
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
|
||||||
<pathelement location="${protobuf.jar}"/>
|
<pathelement location="${protobuf.jar}"/>
|
||||||
@@ -178,16 +180,23 @@
|
|||||||
<sequential if:true="${bootstrap.or.local.build}">
|
<sequential if:true="${bootstrap.or.local.build}">
|
||||||
<copy file="${bootstrap.runtime}" tofile="${kotlin-home}/lib/kotlin-runtime-internal-bootstrap.jar"/>
|
<copy file="${bootstrap.runtime}" tofile="${kotlin-home}/lib/kotlin-runtime-internal-bootstrap.jar"/>
|
||||||
<copy file="${bootstrap.reflect}" tofile="${kotlin-home}/lib/kotlin-reflect-internal-bootstrap.jar"/>
|
<copy file="${bootstrap.reflect}" tofile="${kotlin-home}/lib/kotlin-reflect-internal-bootstrap.jar"/>
|
||||||
|
<copy file="${bootstrap.kotlin.test}" tofile="${kotlin-home}/lib/kotlin-test-internal-bootstrap.jar" failonerror="false"/>
|
||||||
<jar destfile="${kotlin-home}/lib/kotlin-reflect-internal-bootstrap.jar" update="true">
|
<jar destfile="${kotlin-home}/lib/kotlin-reflect-internal-bootstrap.jar" update="true">
|
||||||
<manifest>
|
<manifest>
|
||||||
<attribute name="Class-Path" value="kotlin-runtime-internal-bootstrap.jar"/>
|
<attribute name="Class-Path" value="kotlin-runtime-internal-bootstrap.jar"/>
|
||||||
</manifest>
|
</manifest>
|
||||||
</jar>
|
</jar>
|
||||||
|
<jar destfile="${kotlin-home}/lib/kotlin-test-internal-bootstrap.jar" update="true">
|
||||||
|
<manifest>
|
||||||
|
<attribute name="Class-Path" value="kotlin-runtime-internal-bootstrap.jar"/>
|
||||||
|
</manifest>
|
||||||
|
</jar>
|
||||||
</sequential>
|
</sequential>
|
||||||
|
|
||||||
<sequential unless:true="${bootstrap.or.local.build}">
|
<sequential unless:true="${bootstrap.or.local.build}">
|
||||||
<copy file="${bootstrap.runtime}" todir="${kotlin-home}/lib"/>
|
<copy file="${bootstrap.runtime}" todir="${kotlin-home}/lib"/>
|
||||||
<copy file="${bootstrap.reflect}" todir="${kotlin-home}/lib"/>
|
<copy file="${bootstrap.reflect}" todir="${kotlin-home}/lib"/>
|
||||||
|
<copy file="${bootstrap.kotlin.test}" todir="${kotlin-home}/lib"/>
|
||||||
</sequential>
|
</sequential>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
@@ -792,6 +801,20 @@
|
|||||||
</new-kotlinc>
|
</new-kotlinc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="kotlin.test">
|
||||||
|
<new-kotlinc output="${output}/classes/kotlin.test" moduleName="kotlin-test">
|
||||||
|
<src>
|
||||||
|
<include name="libraries/kotlin.test/shared/src/main/kotlin" />
|
||||||
|
<include name="libraries/kotlin.test/shared/src/main/kotlin.jvm" />
|
||||||
|
<include name="libraries/kotlin.test/junit/src/main/kotlin" />
|
||||||
|
</src>
|
||||||
|
<class-path>
|
||||||
|
<pathelement path="${output}/classes/builtins"/>
|
||||||
|
<pathelement path="libraries/lib/junit-4.11.jar"/>
|
||||||
|
</class-path>
|
||||||
|
</new-kotlinc>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="core">
|
<target name="core">
|
||||||
<new-kotlinc output="${output}/classes/core" moduleName="kotlin-core">
|
<new-kotlinc output="${output}/classes/core" moduleName="kotlin-core">
|
||||||
<src>
|
<src>
|
||||||
@@ -936,15 +959,23 @@
|
|||||||
</pack-runtime-jar>
|
</pack-runtime-jar>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="pack-kotlin-test">
|
||||||
|
<pack-runtime-jar jar-name="kotlin-test.jar" implementation-title="${manifest.impl.title.kotlin.test}">
|
||||||
|
<jar-content>
|
||||||
|
<fileset dir="${output}/classes/kotlin.test" includes="**/*"/>
|
||||||
|
</jar-content>
|
||||||
|
</pack-runtime-jar>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="runtime"
|
<target name="runtime"
|
||||||
depends="builtins,stdlib,core,reflection,pack-runtime,pack-runtime-sources"/>
|
depends="builtins,stdlib,core,reflection,pack-runtime,pack-runtime-sources"/>
|
||||||
|
|
||||||
<target name="dist"
|
<target name="dist"
|
||||||
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin.test,pack-kotlin-test,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
||||||
description="Builds redistributables from sources"/>
|
description="Builds redistributables from sources"/>
|
||||||
|
|
||||||
<target name="dist-quick"
|
<target name="dist-quick"
|
||||||
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin-js-stdlib,android-compiler-plugin"
|
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin.test,pack-kotlin-test,kotlin-js-stdlib,android-compiler-plugin"
|
||||||
description="Builds everything, but classes are reused from project out dir, doesn't run proguard and javadoc"/>
|
description="Builds everything, but classes are reused from project out dir, doesn't run proguard and javadoc"/>
|
||||||
|
|
||||||
<target name="dist-quick-compiler-only"
|
<target name="dist-quick-compiler-only"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin.test.jvm</artifactId>
|
<artifactId>kotlin.test.junit</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin.test.jvm</artifactId>
|
<artifactId>kotlin.test.junit</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -7,13 +7,14 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>kotlin.test.jvm</artifactId>
|
<artifactId>kotlin.test.junit</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>(4,5)</version>
|
<version>(4,5)</version>
|
||||||
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>shared</module>
|
<module>shared</module>
|
||||||
<module>jvm</module>
|
<module>junit</module>
|
||||||
<!--<module>js</module>--> <!-- TODO enable back when js build fixed -->
|
<!--<module>js</module>--> <!-- TODO enable back when js build fixed -->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import kotlin.jvm.internal.*
|
|||||||
import kotlin.reflect.*
|
import kotlin.reflect.*
|
||||||
|
|
||||||
@Deprecated("Use assertFailsWith instead.", ReplaceWith("assertFailsWith(exceptionClass, block)"), kotlin.DeprecationLevel.ERROR)
|
@Deprecated("Use assertFailsWith instead.", ReplaceWith("assertFailsWith(exceptionClass, block)"), kotlin.DeprecationLevel.ERROR)
|
||||||
fun <T : Throwable> failsWith(exceptionClass: Class<T>, block: () -> Any): T = assertFailsWith(exceptionClass, { block() })
|
fun <T : Throwable> failsWith(exceptionClass: Class<T>, block: () -> Any): T = assertFailsWith(exceptionClass) { block() }
|
||||||
|
|
||||||
/** Asserts that a [block] fails with a specific exception being thrown. */
|
/** Asserts that a [block] fails with a specific exception being thrown. */
|
||||||
fun <T : Throwable> assertFailsWith(exceptionClass: Class<T>, block: () -> Unit): T = assertFailsWith(exceptionClass, null, block)
|
fun <T : Throwable> assertFailsWith(exceptionClass: Class<T>, block: () -> Unit): T {
|
||||||
|
return assertFailsWith(exceptionClass, null, block)
|
||||||
|
}
|
||||||
|
|
||||||
/** Asserts that a [block] fails with a specific exception being thrown. */
|
/** Asserts that a [block] fails with a specific exception being thrown. */
|
||||||
fun <T : Throwable> assertFailsWith(exceptionClass: Class<T>, message: String?, block: () -> Unit): T {
|
fun <T : Throwable> assertFailsWith(exceptionClass: Class<T>, message: String?, block: () -> Unit): T {
|
||||||
@@ -28,9 +30,12 @@ fun <T : Throwable> assertFailsWith(exceptionClass: Class<T>, message: String?,
|
|||||||
throw IllegalStateException(msg + "Should have failed.")
|
throw IllegalStateException(msg + "Should have failed.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown. */
|
||||||
|
fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, block: () -> Unit): T = assertFailsWith(exceptionClass, null, block)
|
||||||
|
|
||||||
/** Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown. */
|
/** Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown. */
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String? = null, block: () -> Unit): T = assertFailsWith(exceptionClass.javaClass, message, block)
|
fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T = assertFailsWith(exceptionClass.javaClass, message, block)
|
||||||
|
|
||||||
/** Asserts that a [block] fails with a specific exception of type [T] being thrown.
|
/** Asserts that a [block] fails with a specific exception of type [T] being thrown.
|
||||||
* Since inline method doesn't allow to trace where it was invoked, it is required to pass a [message] to distinguish this method call from others.
|
* Since inline method doesn't allow to trace where it was invoked, it is required to pass a [message] to distinguish this method call from others.
|
||||||
|
|||||||
@@ -175,13 +175,3 @@ interface AsserterContributor {
|
|||||||
fun contribute(): Asserter?
|
fun contribute(): Asserter?
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T, R> T.let(block: (T) -> R): R = block(this)
|
|
||||||
|
|
||||||
internal fun <T> Iterable<T>.firstOrNull(predicate: (T) -> Boolean): T? {
|
|
||||||
for (e in this) {
|
|
||||||
if (predicate(e)) {
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package kotlin.test
|
||||||
|
|
||||||
|
internal fun <T, R> T.let(block: (T) -> R): R = block(this)
|
||||||
|
|
||||||
@@ -24,6 +24,13 @@ class BasicAssertionsJVMTest {
|
|||||||
throw IllegalArgumentException()
|
throw IllegalArgumentException()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Test
|
||||||
|
fun testFailsWithClassMessage() {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
assertFailsWith(Class.forName("java.lang.IllegalArgumentException") as Class<Throwable>) {
|
||||||
|
throw IllegalArgumentException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testToDo() {
|
fun testToDo() {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin.test.jvm</artifactId>
|
<artifactId>kotlin.test.junit</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>kotlin.test.jvm</artifactId>
|
<artifactId>kotlin.test.junit</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
Reference in New Issue
Block a user