Advance String(CharArray) deprecation level to ERROR in Common and JS

This commit is contained in:
Abduqodiri Qurbonzoda
2021-03-26 00:00:06 +03:00
parent 29040d6f53
commit d28d0a6321
8 changed files with 16 additions and 8 deletions
+5 -5
View File
@@ -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) }