Delete wrong toString() extension, fix StringJVMTest

This commit is contained in:
Alexander Udalov
2014-02-25 21:52:35 +04:00
parent d5e2c4ad4c
commit f63cbcfd6a
2 changed files with 3 additions and 5 deletions
+1 -3
View File
@@ -105,9 +105,7 @@ public val ByteArray.inputStream : ByteArrayInputStream
public fun ByteArray.inputStream(offset: Int, length: Int) : ByteArrayInputStream = ByteArrayInputStream(this, offset, length)
public fun ByteArray.toString(encoding: String): String = String(this, encoding)
public fun ByteArray.toString(): String = String(this)
public fun ByteArray.toString(encoding: Charset) : String = String(this, encoding)
public fun ByteArray.toString(encoding: Charset): String = String(this, encoding)
[Intrinsic("kotlin.collections.copyToArray")] public fun <reified T> Collection<T>.copyToArray(): Array<T> =
throw UnsupportedOperationException()
+2 -2
View File
@@ -324,8 +324,8 @@ class StringJVMTest {
test fun toByteArrayEncodings() {
val s = "hello"
val defaultCharset = java.nio.charset.Charset.defaultCharset()!!
assertEquals(s.toByteArray().toString(), s.toByteArray(defaultCharset).toString())
assertEquals(s.toByteArray().toString(), s.toByteArray(defaultCharset.name()).toString())
assertEquals(String(s.toByteArray()), String(s.toByteArray(defaultCharset)))
assertEquals(String(s.toByteArray()), String(s.toByteArray(defaultCharset.name())))
}
test fun testReplaceAllClosure() {