Fix JDK-dependent stdlib tests after advancing jvmTarget

This commit is contained in:
Abduqodiri Qurbonzoda
2022-08-16 13:36:04 +03:00
parent 9e35815ae3
commit 6c4777dcdd
14 changed files with 72 additions and 167 deletions
@@ -6,7 +6,6 @@
package test.exceptions
import test.collections.assertArrayNotSameButEquals
import test.testOnJvm7AndAbove
import java.io.*
import java.nio.charset.Charset
import kotlin.test.*
@@ -96,9 +95,8 @@ class ExceptionJVMTest {
e1.initCause(e2)
assertSame(e1, e2.cause)
assertSame(e2, e1.cause)
testOnJvm7AndAbove {
val trace = e2.stackTraceToString()
assertTrue("CIRCULAR REFERENCE" in trace, trace)
}
val trace = e2.stackTraceToString()
assertTrue("CIRCULAR REFERENCE" in trace, trace)
}
}
+2 -23
View File
@@ -12,25 +12,6 @@ public actual fun assertTypeEquals(expected: Any?, actual: Any?) {
assertEquals(expected?.javaClass, actual?.javaClass)
}
private val isJava6 = System.getProperty("java.version").startsWith("1.6.")
internal actual fun String.removeLeadingPlusOnJava6(): String =
if (isJava6) removePrefix("+") else this
private val isJava7 = System.getProperty("java.version").startsWith("1.7.")
private val isJava8AndAbove = !isJava6 && !isJava7
internal actual inline fun testOnNonJvm6And7(f: () -> Unit) {
if (isJava8AndAbove) {
f()
}
}
internal inline fun testOnJvm7AndAbove(f: () -> Unit) {
if (!isJava6) {
f()
}
}
public actual fun testOnJvm(action: () -> Unit) = action()
public actual fun testOnJs(action: () -> Unit) {}
@@ -39,10 +20,8 @@ public fun <T> platformNull() = Collections.singletonList(null as T).first()
public actual val isFloat32RangeEnforced: Boolean = true
public actual val supportsSuppressedExceptions: Boolean get() = !isJava6
// Named capturing groups are supported starting from java 7. However, retrieving them by name is not supported in java 7.
public actual val supportsNamedCapturingGroup: Boolean get() = isJava8AndAbove
public actual val supportsNamedCapturingGroup: Boolean
get() = System.getProperty("supportsNamedCapturingGroup")?.toBooleanStrict() ?: true
public actual val supportsOctalLiteralInRegex: Boolean get() = true