Advance String(CharArray) deprecation level to ERROR in Common and JS
This commit is contained in:
@@ -47,13 +47,13 @@ fun Char.isAsciiUpperCase() = this in 'A'..'Z'
|
||||
|
||||
class StringTest {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
private fun testStringFromChars(expected: String, chars: CharArray, offset: Int, length: Int) {
|
||||
assertEquals(expected, String(chars, offset, length))
|
||||
assertEquals(expected, chars.concatToString(startIndex = offset, endIndex = offset + length))
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
private fun testStringFromChars(expected: String, chars: CharArray) {
|
||||
assertEquals(expected, String(chars))
|
||||
assertEquals(expected, chars.concatToString())
|
||||
@@ -64,7 +64,7 @@ class StringTest {
|
||||
testStringFromChars("Kotlin", chars, 0, chars.size)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@Test fun stringFromCharArraySlice() {
|
||||
val chars: CharArray = charArrayOf('K', 'o', 't', 'l', 'i', 'n', ' ', 'r', 'u', 'l', 'e', 's')
|
||||
testStringFromChars("rule", chars, 7, 4)
|
||||
@@ -78,7 +78,7 @@ class StringTest {
|
||||
assertTrue(longConcatString.all { it == 'k' })
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@Test fun stringFromCharArray() {
|
||||
val chars: CharArray = charArrayOf('K', 'o', 't', 'l', 'i', 'n')
|
||||
testStringFromChars("Kotlin", chars)
|
||||
@@ -99,7 +99,7 @@ class StringTest {
|
||||
testStringFromChars("Ŭᎍ🀺", chars, 3, 4)
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@Test fun stringFromCharArrayOutOfBounds() {
|
||||
fun test(chars: CharArray) {
|
||||
assertFailsWith<IndexOutOfBoundsException> { String(chars, -1, 1) }
|
||||
|
||||
Reference in New Issue
Block a user