backend/tests: Add blackbox tests from Kotlin JVM
Added tests from testData/codegen/box directory. There are blackbox tests in other directories and they are to be added.
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
// TODO: muted automatically, investigate should it be ran for JS or not
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
// FILE: Test.java
|
||||
|
||||
public class Test {
|
||||
public static String invokeFoo() {
|
||||
try {
|
||||
ExtensionKt.foo(null);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
try {
|
||||
ExtensionKt.getBar(null);
|
||||
}
|
||||
catch (IllegalArgumentException f) {
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
return "Fail: assertion must have been fired";
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: extension.kt
|
||||
|
||||
fun Any.foo() { }
|
||||
|
||||
val Any.bar: String get() = ""
|
||||
|
||||
fun box(): String {
|
||||
return Test.invokeFoo()
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
fun <K: Any, V: Any> foo(k: K, v: V) {
|
||||
val map = HashMap<K, V>()
|
||||
val old = map.put(k, v)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo("", "")
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user