Extracted string-parsing extensions and their tests into separate files.
This commit is contained in:
@@ -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())
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user