mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
23 lines
426 B
Kotlin
Vendored
23 lines
426 B
Kotlin
Vendored
// IGNORE_BACKEND: JS_IR
|
|
enum class Color {
|
|
RED,
|
|
BLUE
|
|
}
|
|
|
|
fun throwsOnGreen(): Boolean {
|
|
try {
|
|
Color.valueOf("GREEN")
|
|
return false
|
|
}
|
|
catch (e: Exception) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
fun box() = if(
|
|
Color.valueOf("RED") == Color.RED
|
|
&& Color.valueOf("BLUE") == Color.BLUE
|
|
&& Color.values()[0] == Color.RED
|
|
&& Color.values()[1] == Color.BLUE
|
|
&& throwsOnGreen()
|
|
) "OK" else "fail" |