Introduce String.toCharArray() instead of String.getChars()
Make special method conversion for java.lang.String.getChars() in J2K
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package test.text
|
||||
|
||||
import test.collections.assertArrayNotSameButEquals
|
||||
import java.util.Locale
|
||||
import kotlin.test.*
|
||||
|
||||
@@ -79,6 +80,16 @@ class StringJVMTest {
|
||||
assertEquals(String(s.toByteArray()), String(s.toByteArray(defaultCharset.name())))
|
||||
}
|
||||
|
||||
@test fun toCharArray() {
|
||||
val s = "hello"
|
||||
val chars = s.toCharArray()
|
||||
assertArrayNotSameButEquals(charArrayOf('h', 'e', 'l', 'l', 'o'), chars)
|
||||
|
||||
val buffer = CharArray(4)
|
||||
s.toCharArray(buffer, 2, 1, 3)
|
||||
assertArrayNotSameButEquals(charArrayOf('\u0000', '\u0000', 'e', 'l'), buffer)
|
||||
}
|
||||
|
||||
@test fun orderIgnoringCase() {
|
||||
val list = listOf("Beast", "Ast", "asterisk")
|
||||
assertEquals(listOf("Ast", "Beast", "asterisk"), list.sorted())
|
||||
|
||||
Reference in New Issue
Block a user