Files
kotlin-fork/compiler/testData/codegen/box/ranges/contains/inExtensionRange.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

20 lines
494 B
Kotlin
Vendored

// WITH_STDLIB
import kotlin.test.*
operator fun Int.rangeTo(right: String): ClosedRange<Int> = this..this + 1
operator fun Long.rangeTo(right: Double): ClosedRange<Long> = this..right.toLong() + 1
operator fun String.rangeTo(right: Int): ClosedRange<String> = this..this
fun box(): String {
assertTrue(0 !in 1.."a")
assertTrue(1 in 1.."a")
assertTrue(0L !in 1L..2.0)
assertTrue(2L in 1L..3.0)
assertTrue("a" !in "b"..1)
assertTrue("a" in "a"..1)
return "OK"
}