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.collections
import test.collections.behaviors.*
import test.testOnNonJvm6And7
import kotlin.test.*
class AbstractCollectionsTest {
@@ -128,9 +127,7 @@ class AbstractCollectionsTest {
assertEquals(listOf("ok", "element"), list)
testOnNonJvm6And7 {
assertFailsWith<IndexOutOfBoundsException> { list.addAll(-1, listOf()) }
}
assertFailsWith<IndexOutOfBoundsException> { list.addAll(-1, listOf()) }
compare(list.storage, list) {
listBehavior()
@@ -5,7 +5,6 @@
package test.exceptions
import test.supportsSuppressedExceptions
import kotlin.test.*
@Suppress("Reformat") // author's formatting
@@ -81,11 +80,7 @@ class ExceptionTest {
e1.addSuppressed(c1)
e1.addSuppressed(c2)
if (supportsSuppressedExceptions) {
assertEquals(listOf(c1, c2), e1.suppressedExceptions)
} else {
assertTrue(e1.suppressedExceptions.isEmpty())
}
assertEquals(listOf(c1, c2), e1.suppressedExceptions)
}
@Test
@@ -122,12 +117,10 @@ class ExceptionTest {
val cause = assertNotNull(e.cause, "Should have cause")
assertInTrace(cause)
if (supportsSuppressedExceptions) {
val topLevelSuppressed = e.suppressedExceptions.single()
assertInTrace(topLevelSuppressed)
cause.suppressedExceptions.forEach {
assertInTrace(it)
}
val topLevelSuppressed = e.suppressedExceptions.single()
assertInTrace(topLevelSuppressed)
cause.suppressedExceptions.forEach {
assertInTrace(it)
}
// fail(topLevelTrace) // to dump the entire trace
@@ -135,8 +128,6 @@ class ExceptionTest {
@Test
fun circularSuppressedDetailedTrace() {
if (!supportsSuppressedExceptions) return
// Testing an exception of the following structure
// e1
// -- suppressed: e0 (same stack as e1)
+16 -21
View File
@@ -5,7 +5,6 @@
package test.text
import test.testOnNonJvm6And7
import kotlin.test.*
class CharTest {
@@ -525,32 +524,28 @@ class CharTest {
@Test
fun otherLowercaseProperty() {
testOnNonJvm6And7 {
val feminineOrdinalIndicator = '\u00AA'
assertTrue(feminineOrdinalIndicator.isLowerCase())
assertTrue(feminineOrdinalIndicator.isLetter())
assertFalse(feminineOrdinalIndicator.isUpperCase())
val feminineOrdinalIndicator = '\u00AA'
assertTrue(feminineOrdinalIndicator.isLowerCase())
assertTrue(feminineOrdinalIndicator.isLetter())
assertFalse(feminineOrdinalIndicator.isUpperCase())
val circledLatinSmallLetterA = '\u24D0'
assertTrue(circledLatinSmallLetterA.isLowerCase())
assertFalse(circledLatinSmallLetterA.isLetter())
assertFalse(circledLatinSmallLetterA.isUpperCase())
}
val circledLatinSmallLetterA = '\u24D0'
assertTrue(circledLatinSmallLetterA.isLowerCase())
assertFalse(circledLatinSmallLetterA.isLetter())
assertFalse(circledLatinSmallLetterA.isUpperCase())
}
@Test
fun otherUppercaseProperty() {
testOnNonJvm6And7 {
val romanNumberOne = '\u2160'
assertTrue(romanNumberOne.isUpperCase())
assertFalse(romanNumberOne.isLetter())
assertFalse(romanNumberOne.isLowerCase())
val romanNumberOne = '\u2160'
assertTrue(romanNumberOne.isUpperCase())
assertFalse(romanNumberOne.isLetter())
assertFalse(romanNumberOne.isLowerCase())
val circledLatinCapitalLetterZ = '\u24CF'
assertTrue(circledLatinCapitalLetterZ.isUpperCase())
assertFalse(circledLatinCapitalLetterZ.isLetter())
assertFalse(circledLatinCapitalLetterZ.isLowerCase())
}
val circledLatinCapitalLetterZ = '\u24CF'
assertTrue(circledLatinCapitalLetterZ.isUpperCase())
assertFalse(circledLatinCapitalLetterZ.isLetter())
assertFalse(circledLatinCapitalLetterZ.isLowerCase())
}
@Test
@@ -6,7 +6,6 @@
package test.text
import test.assertArrayContentEquals
import test.testOnNonJvm6And7
import kotlin.test.*
// When decoding utf-8, JVM and JS implementations replace the sequence reflecting a surrogate code point differently.
@@ -207,28 +206,26 @@ class StringEncodingTest {
testDecoding(false, "z", bytes(0xE0, 0xAF, 0x7A)) // 3-byte char, third byte starts with 0 bit
testDecoding(true, "\u1FFF", bytes(0xE1, 0xBF, 0xBF)) // 3-byte char
testOnNonJvm6And7 {
testDecoding(false, surrogateCodePointDecoding, bytes(0xED, 0xAF, 0xBF)) // 3-byte high-surrogate char
testDecoding(false, surrogateCodePointDecoding, bytes(0xED, 0xB3, 0x9A)) // 3-byte low-surrogate char
testDecoding(
false,
surrogateCodePointDecoding + surrogateCodePointDecoding,
bytes(0xED, 0xAF, 0xBF, /**/ 0xED, 0xB3, 0x9A)
) // surrogate pair chars
testDecoding(false, "z", bytes(0xEF, 0x7A)) // 3-byte char, second byte starts with 0 bit, third byte missing
testDecoding(false, surrogateCodePointDecoding, bytes(0xED, 0xAF, 0xBF)) // 3-byte high-surrogate char
testDecoding(false, surrogateCodePointDecoding, bytes(0xED, 0xB3, 0x9A)) // 3-byte low-surrogate char
testDecoding(
false,
surrogateCodePointDecoding + surrogateCodePointDecoding,
bytes(0xED, 0xAF, 0xBF, /**/ 0xED, 0xB3, 0x9A)
) // surrogate pair chars
testDecoding(false, "z", bytes(0xEF, 0x7A)) // 3-byte char, second byte starts with 0 bit, third byte missing
testDecoding(false, "", bytes(0xF9, 0x94, 0x80, 0x80, 0x80)) // 5-byte code point larger than 0x10FFFF
testDecoding(false, "", bytes(0xFD, 0x94, 0x80, 0x80, 0x80, 0x80)) // 6-byte code point larger than 0x10FFFF
testDecoding(false, "", bytes(0xF9, 0x94, 0x80, 0x80, 0x80)) // 5-byte code point larger than 0x10FFFF
testDecoding(false, "", bytes(0xFD, 0x94, 0x80, 0x80, 0x80, 0x80)) // 6-byte code point larger than 0x10FFFF
// Ill-Formed Sequences for Surrogates
testDecoding(
false,
surrogateCodePointDecoding + surrogateCodePointDecoding + truncatedSurrogateDecoding() + "A",
bytes(0xED, 0xA0, 0x80, /**/ 0xED, 0xBF, 0xBF, /**/ 0xED, 0xAF, /**/ 0x41)
)
// Truncated Sequences
testDecoding(false, "A", bytes(0xE1, 0x80, /**/ 0xE2, /**/ 0xF0, 0x91, 0x92, /**/ 0xF1, 0xBF, /**/ 0x41))
}
// Ill-Formed Sequences for Surrogates
testDecoding(
false,
surrogateCodePointDecoding + surrogateCodePointDecoding + truncatedSurrogateDecoding() + "A",
bytes(0xED, 0xA0, 0x80, /**/ 0xED, 0xBF, 0xBF, /**/ 0xED, 0xAF, /**/ 0x41)
)
// Truncated Sequences
testDecoding(false, "A", bytes(0xE1, 0x80, /**/ 0xE2, /**/ 0xF0, 0x91, 0x92, /**/ 0xF1, 0xBF, /**/ 0x41))
testDecoding(false, "", bytes(0xE0, 0xAF)) // 3-byte char, third byte missing
@@ -275,13 +272,11 @@ class StringEncodingTest {
testDecoding(false, "z", bytes(0xEF, 0xAF, 0x7A), startIndex = 1, endIndex = 3)
testDecoding(true, "z", bytes(0xEF, 0xAF, 0x7A), startIndex = 2, endIndex = 3)
testOnNonJvm6And7 {
testDecoding(false, surrogateCodePointDecoding, bytes(0xED, 0xAF, 0xBF), startIndex = 0, endIndex = 3)
testDecoding(false, truncatedSurrogateDecoding(), bytes(0xED, 0xB3, 0x9A), startIndex = 0, endIndex = 2)
testDecoding(false, "", bytes(0xED, 0xAF, 0xBF, 0xED, 0xB3, 0x9A), startIndex = 1, endIndex = 4)
testDecoding(false, "", bytes(0xEF, 0x7A), startIndex = 0, endIndex = 1)
testDecoding(true, "z", bytes(0xEF, 0x7A), startIndex = 1, endIndex = 2)
}
testDecoding(false, surrogateCodePointDecoding, bytes(0xED, 0xAF, 0xBF), startIndex = 0, endIndex = 3)
testDecoding(false, truncatedSurrogateDecoding(), bytes(0xED, 0xB3, 0x9A), startIndex = 0, endIndex = 2)
testDecoding(false, "", bytes(0xED, 0xAF, 0xBF, 0xED, 0xB3, 0x9A), startIndex = 1, endIndex = 4)
testDecoding(false, "", bytes(0xEF, 0x7A), startIndex = 0, endIndex = 1)
testDecoding(true, "z", bytes(0xEF, 0x7A), startIndex = 1, endIndex = 2)
testDecoding(true, "\uD83D\uDFDF", bytes(0xF0, 0x9F, 0x9F, 0x9F), startIndex = 0, endIndex = 4)
testDecoding(false, "", bytes(0xF0, 0x9F, 0x9F, 0x9F), startIndex = 2, endIndex = 4)
@@ -5,7 +5,6 @@
package test.text
import test.*
import kotlin.test.*
class StringNumberConversionTest {
@@ -439,7 +438,7 @@ internal class ConversionContext<T : Any>(
}
fun assertProduces(input: String, output: T) {
assertEquals(output, convertOrFail(input.removeLeadingPlusOnJava6()), input, "convertOrFail")
assertEquals(output, convertOrFail(input), input, "convertOrFail")
assertEquals(output, convertOrNull(input), input, "convertOrNull")
}
@@ -454,7 +453,7 @@ internal class ConversionWithRadixContext<T : Any>(
val convertOrNull: (String, Int) -> T?
) {
fun assertProduces(radix: Int, input: String, output: T) {
assertEquals(output, convertOrFail(input.removeLeadingPlusOnJava6(), radix))
assertEquals(output, convertOrFail(input, radix))
assertEquals(output, convertOrNull(input, radix))
}