Some improvements in tests

This commit is contained in:
Andrew Golovashevich 2025-03-26 01:53:54 +03:00
parent 099c3fad26
commit 25cb516d0f
2 changed files with 8 additions and 7 deletions

View File

@ -61,6 +61,7 @@ xomrk {
} }
} }
val jvmMain by getting { val jvmMain by getting {
dependsOn(commonMain)
dependencies { dependencies {
compileOnly(kotlinStdlibDependency) compileOnly(kotlinStdlibDependency)
} }

View File

@ -1,7 +1,6 @@
package ru.landgrafhomyak.utility.highlevel_try_finally.tests package ru.landgrafhomyak.utility.highlevel_try_finally.tests
import org.testng.annotations.Test import org.testng.annotations.Test
import org.testng.asserts.Assertion
import ru.landgrafhomyak.utility.highlevel_try_finally.safeAutoClose1 import ru.landgrafhomyak.utility.highlevel_try_finally.safeAutoClose1
@Test @Test
@ -9,13 +8,14 @@ class KotlinStdlibDependencyTest {
@Test @Test
fun testNoKotlinStdlib() { fun testNoKotlinStdlib() {
try { try {
KotlinVersion.CURRENT if (KotlinVersion.CURRENT.major != -1)
Assertion().assertTrue(false, "Kotlin stdlib still in runtime classpath") throw AssertionError("Kotlin stdlib still in runtime classpath")
} catch (_: LinkageError) { } catch (_: LinkageError) {
} }
} }
private class CustomTestException : RuntimeException() private class CustomTestException : RuntimeException()
private object CustomUnit
private fun throw7throwFn() { private fun throw7throwFn() {
safeAutoClose1(finally = { throw CustomTestException() }, action = { throw CustomTestException() }) safeAutoClose1(finally = { throw CustomTestException() }, action = { throw CustomTestException() })
@ -31,8 +31,8 @@ class KotlinStdlibDependencyTest {
try { try {
throw7throwFn() throw7throwFn()
} catch (_: CustomTestException) { } catch (_: CustomTestException) {
} catch (_: LinkageError) { } catch (le: LinkageError) {
Assertion().assertTrue(false, "safeAutoClose still has dependency on kotlin stdlib") throw AssertionError("safeAutoClose still has dependency on kotlin stdlib", le)
} }
} }
@ -41,8 +41,8 @@ class KotlinStdlibDependencyTest {
try { try {
throw7throwIn() throw7throwIn()
} catch (_: CustomTestException) { } catch (_: CustomTestException) {
} catch (_: LinkageError) { } catch (le: LinkageError) {
Assertion().assertTrue(false, "safeAutoClose still has dependency on kotlin stdlib") throw AssertionError("safeAutoClose still has dependency on kotlin stdlib", le)
} }
} }
} }