separate compiler and plugin tests
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
class C(val p: Boolean) { }
|
||||
|
||||
fun box(): String {
|
||||
val c = C(true)
|
||||
return when(c) {
|
||||
.p => "OK"
|
||||
else => "fail"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun isZero(x: Int) = when(x) {
|
||||
0 => true
|
||||
else => false
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun isZero(x: Int) = when(x) {
|
||||
0 => true
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun isDigit(a: Int) : String {
|
||||
val aa = java.util.ArrayList<Int> ()
|
||||
aa.add(239)
|
||||
|
||||
if(a in aa) return "array list"
|
||||
if(a in 0..9) return "digit"
|
||||
if(a !in 0..100) return "not small"
|
||||
return "something"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fun typeName(a: Any?) : String {
|
||||
return when(a) {
|
||||
is java.util.ArrayList<Int> => "array list"
|
||||
else => "no idea"
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
if(typeName(java.util.ArrayList<Int> ()) != "array list") return "array list failed"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun isString(x: Any) = when(x) {
|
||||
is String => "string"
|
||||
else => "something"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fun isDigit(a: Int) : String {
|
||||
val aa = java.util.ArrayList<Int> ()
|
||||
aa.add(239)
|
||||
|
||||
return when(a) {
|
||||
in aa => "array list"
|
||||
in 0..9 => "digit"
|
||||
!in 0..100 => "not small"
|
||||
else => "something"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
fun isDigit(a: Char) = when(a) {
|
||||
in '0'..'9' => "digit"
|
||||
else => "something"
|
||||
}
|
||||
Reference in New Issue
Block a user