Some improvements in tests
This commit is contained in:
parent
099c3fad26
commit
25cb516d0f
@ -61,6 +61,7 @@ xomrk {
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependsOn(commonMain)
|
||||
dependencies {
|
||||
compileOnly(kotlinStdlibDependency)
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package ru.landgrafhomyak.utility.highlevel_try_finally.tests
|
||||
|
||||
import org.testng.annotations.Test
|
||||
import org.testng.asserts.Assertion
|
||||
import ru.landgrafhomyak.utility.highlevel_try_finally.safeAutoClose1
|
||||
|
||||
@Test
|
||||
@ -9,13 +8,14 @@ class KotlinStdlibDependencyTest {
|
||||
@Test
|
||||
fun testNoKotlinStdlib() {
|
||||
try {
|
||||
KotlinVersion.CURRENT
|
||||
Assertion().assertTrue(false, "Kotlin stdlib still in runtime classpath")
|
||||
if (KotlinVersion.CURRENT.major != -1)
|
||||
throw AssertionError("Kotlin stdlib still in runtime classpath")
|
||||
} catch (_: LinkageError) {
|
||||
}
|
||||
}
|
||||
|
||||
private class CustomTestException : RuntimeException()
|
||||
private object CustomUnit
|
||||
|
||||
private fun throw7throwFn() {
|
||||
safeAutoClose1(finally = { throw CustomTestException() }, action = { throw CustomTestException() })
|
||||
@ -31,8 +31,8 @@ class KotlinStdlibDependencyTest {
|
||||
try {
|
||||
throw7throwFn()
|
||||
} catch (_: CustomTestException) {
|
||||
} catch (_: LinkageError) {
|
||||
Assertion().assertTrue(false, "safeAutoClose still has dependency on kotlin stdlib")
|
||||
} catch (le: LinkageError) {
|
||||
throw AssertionError("safeAutoClose still has dependency on kotlin stdlib", le)
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ class KotlinStdlibDependencyTest {
|
||||
try {
|
||||
throw7throwIn()
|
||||
} catch (_: CustomTestException) {
|
||||
} catch (_: LinkageError) {
|
||||
Assertion().assertTrue(false, "safeAutoClose still has dependency on kotlin stdlib")
|
||||
} catch (le: LinkageError) {
|
||||
throw AssertionError("safeAutoClose still has dependency on kotlin stdlib", le)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user