Introduce a deprecated StringBuilder.append(CharArray, Int, Int) in Common #KT-52336
This commit is contained in:
committed by
Space
parent
faedd76b32
commit
0db9326105
@@ -5,6 +5,7 @@
|
||||
|
||||
package test.text
|
||||
|
||||
import test.testOnJvm
|
||||
import kotlin.random.Random
|
||||
import kotlin.test.*
|
||||
import kotlin.text.*
|
||||
@@ -32,6 +33,23 @@ class StringBuilderTest {
|
||||
})
|
||||
}
|
||||
|
||||
// KT-52336
|
||||
@Test
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
fun deprecatedAppend() {
|
||||
val chars = charArrayOf('a', 'b', 'c', 'd')
|
||||
val sb = StringBuilder()
|
||||
testOnJvm {
|
||||
sb.append(chars, 1, 2) // Should fail after KT-15220 gets fixed
|
||||
assertEquals("bc", sb.toString())
|
||||
}
|
||||
if (sb.isEmpty()) {
|
||||
assertFailsWith<NotImplementedError> {
|
||||
sb.append(chars, 1, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun asCharSequence() {
|
||||
val original = "Some test string"
|
||||
val sb = StringBuilder(original)
|
||||
|
||||
Reference in New Issue
Block a user