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
+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