c7435ba760
We are going to deprecate `WITH_RUNTIME` directive. The main reason behind this change is that `WITH_STDLIB` directive better describes its meaning, specifically it will add kotlin stdlib to test's classpath.
44 lines
1.1 KiB
Kotlin
Vendored
44 lines
1.1 KiB
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND: JVM
|
|
// ASSERTIONS_MODE: jvm
|
|
// WITH_STDLIB
|
|
|
|
package classAssertions
|
|
|
|
class ShouldBeEnabled {
|
|
fun checkTrue(): Boolean {
|
|
class Local {
|
|
var hit = false
|
|
init {
|
|
assert({ hit = true; true}())
|
|
}
|
|
}
|
|
return Local().hit
|
|
}
|
|
}
|
|
|
|
class ShouldBeDisabled {
|
|
fun checkFalse(): Boolean {
|
|
class Local {
|
|
var hit = false
|
|
init {
|
|
assert({ hit = true; true}())
|
|
}
|
|
}
|
|
return Local().hit
|
|
}
|
|
}
|
|
|
|
class Dummy
|
|
|
|
fun box(): String {
|
|
val loader = Dummy::class.java.classLoader
|
|
loader.setClassAssertionStatus("classAssertions.ShouldBeEnabled", true)
|
|
loader.setClassAssertionStatus("classAssertions.ShouldBeDisabled", false)
|
|
val c1 = loader.loadClass("classAssertions.ShouldBeEnabled").newInstance() as ShouldBeEnabled
|
|
val c2 = loader.loadClass("classAssertions.ShouldBeDisabled").newInstance() as ShouldBeDisabled
|
|
if (!c1.checkTrue()) return "FAIL 0"
|
|
if (c2.checkFalse()) return "FAIL 1"
|
|
return "OK"
|
|
}
|