Extracted string-parsing extensions and their tests into separate files.

This commit is contained in:
voddan
2016-03-20 17:24:11 +03:00
committed by Ilya Gorbunov
parent fcd9ee037e
commit fb51d21888
4 changed files with 91 additions and 53 deletions
@@ -0,0 +1,33 @@
@file:kotlin.jvm.JvmVersion
package test.text
import kotlin.test.assertEquals
import kotlin.test.assertFails
import org.junit.Test as test
class ParsePrimitivesJVMTest {
@test fun toBoolean() {
assertEquals(true, "true".toBoolean())
assertEquals(true, "True".toBoolean())
assertEquals(false, "false".toBoolean())
assertEquals(false, "not so true".toBoolean())
}
@test fun toByte() {
assertEquals(77.toByte(), "77".toByte())
assertFails { "255".toByte() }
}
@test fun toShort() {
assertEquals(77.toShort(), "77".toShort())
}
@test fun toInt() {
assertEquals(77, "77".toInt())
}
@test fun toLong() {
assertEquals(77.toLong(), "77".toLong())
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
package test.text
import test.collections.assertArrayNotSameButEquals
import java.util.Locale
import java.util.*
import kotlin.test.*
import org.junit.Test