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:
Ilya Matveev
2017-01-12 19:43:20 +07:00
parent d5988297b1
commit 1b553ebfaf
2643 changed files with 66666 additions and 0 deletions
@@ -0,0 +1,34 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyCollection<T>: Collection<T> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw UnsupportedOperationException()
override fun containsAll(c: Collection<T>): Boolean = false
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
}
fun expectUoe(block: () -> Any) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val myCollection = MyCollection<String>()
val collection = myCollection as java.util.Collection<String>
expectUoe { collection.add("") }
expectUoe { collection.remove("") }
expectUoe { collection.addAll(myCollection) }
expectUoe { collection.removeAll(myCollection) }
expectUoe { collection.retainAll(myCollection) }
expectUoe { collection.clear() }
return "OK"
}
@@ -0,0 +1,16 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyIterator<T>(val v: T): Iterator<T> {
override fun next(): T = v
override fun hasNext(): Boolean = true
}
fun box(): String {
try {
(MyIterator<String>("") as java.util.Iterator<String>).remove()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
return "OK"
}
}
@@ -0,0 +1,14 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyIterator<T>(val v: T): Iterator<T> {
override fun next(): T = v
override fun hasNext(): Boolean = true
public fun remove() {}
}
fun box(): String {
(MyIterator<String>("") as java.util.Iterator<String>).remove()
return "OK"
}
@@ -0,0 +1,42 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyList<T>: List<T> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw Error()
override fun containsAll(c: Collection<T>): Boolean = false
override fun get(index: Int): T = throw IndexOutOfBoundsException()
override fun indexOf(o: T): Int = -1
override fun lastIndexOf(o: T): Int = -1
override fun listIterator(): ListIterator<T> = throw Error()
override fun listIterator(index: Int): ListIterator<T> = throw Error()
override fun subList(fromIndex: Int, toIndex: Int): List<T> = this
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
}
fun expectUoe(block: () -> Any) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val list = MyList<String>() as java.util.List<String>
expectUoe { list.add("") }
expectUoe { list.remove("") }
expectUoe { list.addAll(list) }
expectUoe { list.removeAll(list) }
expectUoe { list.retainAll(list) }
expectUoe { list.clear() }
expectUoe { list.set(0, "") }
expectUoe { list.add(0, "") }
expectUoe { list.remove(0) }
return "OK"
}
@@ -0,0 +1,28 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyListIterator<T> : ListIterator<T> {
override fun next(): T = null!!
override fun hasNext(): Boolean = null!!
override fun hasPrevious(): Boolean = null!!
override fun previous(): T = null!!
override fun nextIndex(): Int = null!!
override fun previousIndex(): Int = null!!
}
fun expectUoe(block: () -> Any) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val list = MyListIterator<String>() as java.util.ListIterator<String>
expectUoe { list.set("") }
expectUoe { list.add("") }
return "OK"
}
@@ -0,0 +1,45 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyList<T>(val v: T): List<T> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw Error()
override fun containsAll(c: Collection<T>): Boolean = false
override fun get(index: Int): T = v
override fun indexOf(o: T): Int = -1
override fun lastIndexOf(o: T): Int = -1
override fun listIterator(): ListIterator<T> = throw Error()
override fun listIterator(index: Int): ListIterator<T> = throw Error()
override fun subList(fromIndex: Int, toIndex: Int): List<T> = throw Error()
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
public fun add(e: T): Boolean = true
public fun remove(o: T): Boolean = true
public fun addAll(c: Collection<T>): Boolean = true
public fun addAll(index: Int, c: Collection<T>): Boolean = true
public fun removeAll(c: Collection<T>): Boolean = true
public fun retainAll(c: Collection<T>): Boolean = true
public fun clear() {}
public fun set(index: Int, element: T): T = element
public fun add(index: Int, element: T) {}
public fun removeAt(index: Int): T = v
}
fun box(): String {
val list = MyList<String>("") as java.util.List<String>
list.add("")
list.remove("")
list.addAll(list)
list.removeAll(list)
list.retainAll(list)
list.clear()
list.set(0, "")
list.add(0, "")
list.remove(0)
return "OK"
}
@@ -0,0 +1,47 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
open class Super<T>(val v: T) {
public fun add(e: T): Boolean = true
public fun remove(o: T): Boolean = true
public fun addAll(c: Collection<T>): Boolean = true
public fun addAll(index: Int, c: Collection<T>): Boolean = true
public fun removeAll(c: Collection<T>): Boolean = true
public fun retainAll(c: Collection<T>): Boolean = true
public fun clear() {}
public fun set(index: Int, element: T): T = element
public fun add(index: Int, element: T) {}
public fun removeAt(index: Int): T = v
}
class MyList<T>(v: T): Super<T>(v), List<T> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw Error()
override fun containsAll(c: Collection<T>): Boolean = false
override fun get(index: Int): T = v
override fun indexOf(o: T): Int = -1
override fun lastIndexOf(o: T): Int = -1
override fun listIterator(): ListIterator<T> = throw Error()
override fun listIterator(index: Int): ListIterator<T> = throw Error()
override fun subList(fromIndex: Int, toIndex: Int): List<T> = throw Error()
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
}
fun box(): String {
val list = MyList<String>("") as java.util.List<String>
list.add("")
list.remove("")
list.addAll(list)
list.removeAll(list)
list.retainAll(list)
list.clear()
list.set(0, "")
list.add(0, "")
list.remove(0)
return "OK"
}
@@ -0,0 +1,34 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyMap<K, V>: Map<K, V> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun containsKey(key: K): Boolean = false
override fun containsValue(value: V): Boolean = false
override fun get(key: K): V? = null
override val keys: Set<K> get() = throw UnsupportedOperationException()
override val values: Collection<V> get() = throw UnsupportedOperationException()
override val entries: Set<Map.Entry<K, V>> get() = throw UnsupportedOperationException()
}
fun expectUoe(block: () -> Unit) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val myMap = MyMap<String, Int>()
val map = myMap as java.util.Map<String, Int>
expectUoe { map.put("", 1) }
expectUoe { map.remove("") }
expectUoe { map.putAll(myMap) }
expectUoe { map.clear() }
return "OK"
}
@@ -0,0 +1,18 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyMapEntry<K, V>: Map.Entry<K, V> {
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
override val key: K get() = throw UnsupportedOperationException()
override val value: V get() = throw UnsupportedOperationException()
}
fun box(): String {
try {
(MyMapEntry<String, Int>() as java.util.Map.Entry<String, Int>).setValue(1)
throw AssertionError()
} catch (e: UnsupportedOperationException) {
return "OK"
}
}
@@ -0,0 +1,17 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyMapEntry<K, V>: Map.Entry<K, V> {
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
override val key: K get() = throw UnsupportedOperationException()
override val value: V get() = throw UnsupportedOperationException()
public fun setValue(value: V): V = value
}
fun box(): String {
(MyMapEntry<String, Int>() as java.util.Map.Entry<String, Int>).setValue(1)
return "OK"
}
@@ -0,0 +1,31 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyMap<K, V>: Map<K, V> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun containsKey(key: K): Boolean = false
override fun containsValue(value: V): Boolean = false
override fun get(key: K): V? = null
override val keys: Set<K> get() = throw UnsupportedOperationException()
override val values: Collection<V> get() = throw UnsupportedOperationException()
override val entries: Set<Map.Entry<K, V>> get() = throw UnsupportedOperationException()
public fun put(key: K, value: V): V? = null
public fun remove(key: K): V? = null
public fun putAll(m: Map<out K, V>) {}
public fun clear() {}
}
fun box(): String {
val myMap = MyMap<String, Int>()
val map = myMap as java.util.Map<String, Int>
map.put("", 1)
map.remove("")
map.putAll(myMap)
map.clear()
return "OK"
}
@@ -0,0 +1,42 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyList: List<String> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: String): Boolean = false
override fun iterator(): Iterator<String> = throw Error()
override fun containsAll(c: Collection<String>): Boolean = false
override fun get(index: Int): String = throw IndexOutOfBoundsException()
override fun indexOf(o: String): Int = -1
override fun lastIndexOf(o: String): Int = -1
override fun listIterator(): ListIterator<String> = throw Error()
override fun listIterator(index: Int): ListIterator<String> = throw Error()
override fun subList(fromIndex: Int, toIndex: Int): List<String> = this
override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false
}
fun expectUoe(block: () -> Any) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val list = MyList() as java.util.List<String>
expectUoe { list.add("") }
expectUoe { list.remove("") }
expectUoe { list.addAll(list) }
expectUoe { list.removeAll(list) }
expectUoe { list.retainAll(list) }
expectUoe { list.clear() }
expectUoe { list.set(0, "") }
expectUoe { list.add(0, "") }
expectUoe { list.remove(0) }
return "OK"
}
@@ -0,0 +1,23 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
abstract class A : Iterator<String> {
abstract fun remove(): Unit
}
class B(var result: String) : A() {
override fun next() = ""
override fun hasNext() = false
override fun remove() {
result = "OK"
}
}
fun box(): String {
val a = B("Fail") as java.util.Iterator<String>
a.next()
a.hasNext()
a.remove()
return (a as B).result
}
@@ -0,0 +1,34 @@
class A : Collection<Char> {
override val size: Int
get() = throw UnsupportedOperationException()
override fun contains(element: Char): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun containsAll(elements: Collection<Char>): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun isEmpty(): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun iterator() = MyIterator
}
object MyIterator : Iterator<Char> {
override fun hasNext() = true
override fun next() = 'a'
}
fun box(): String {
val it: MyIterator = A().iterator()
if (!it.hasNext()) return "fail 1"
if (it.next() != 'a') return "fail 2"
return "OK"
}
@@ -0,0 +1,49 @@
// TARGET_BACKEND: JVM
import java.util.ArrayList
class A<E> : List<E> by ArrayList<E>()
class B : List<String> by A<String>()
fun expectUoe(block: () -> Any) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val a = A<String>() as java.util.List<String>
expectUoe { a.add("") }
expectUoe { a.remove("") }
expectUoe { a.addAll(a) }
expectUoe { a.addAll(0, a) }
expectUoe { a.removeAll(a) }
expectUoe { a.retainAll(a) }
expectUoe { a.clear() }
expectUoe { a.add(0, "") }
expectUoe { a.set(0, "") }
expectUoe { a.remove(0) }
a.listIterator()
a.listIterator(0)
a.subList(0, 0)
val b = B() as java.util.List<String>
expectUoe { b.add("") }
expectUoe { b.remove("") }
expectUoe { b.addAll(b) }
expectUoe { b.addAll(0, b) }
expectUoe { b.removeAll(b) }
expectUoe { b.retainAll(b) }
expectUoe { b.clear() }
expectUoe { b.add(0, "") }
expectUoe { b.set(0, "") }
expectUoe { b.remove(0) }
b.listIterator()
b.listIterator(0)
b.subList(0, 0)
return "OK"
}
@@ -0,0 +1,22 @@
// TARGET_BACKEND: JVM
import java.util.AbstractList
class A : AbstractList<String>() {
override fun get(index: Int): String = ""
override val size: Int get() = 0
}
fun box(): String {
val a = A()
val b = A()
a.addAll(b)
a.addAll(0, b)
a.removeAll(b)
a.retainAll(b)
a.clear()
a.remove("")
return "OK"
}
@@ -0,0 +1,24 @@
// TARGET_BACKEND: JVM
import java.util.AbstractMap
import java.util.Collections
class A : AbstractMap<Int, String>() {
override val entries: MutableSet<MutableMap.MutableEntry<Int, String>> get() = Collections.emptySet()
}
fun box(): String {
val a = A()
val b = A()
a.remove(0)
a.putAll(b)
a.clear()
a.keys
a.values
a.entries
return "OK"
}
@@ -0,0 +1,18 @@
class A : HashSet<Long>()
fun box(): String {
val a = A()
val b = A()
a.iterator()
a.add(0L)
a.remove(0L)
a.addAll(b)
a.removeAll(b)
a.retainAll(b)
a.clear()
return "OK"
}
@@ -0,0 +1,22 @@
// KT-6042 java.lang.UnsupportedOperationException with ArrayList
class A : ArrayList<String>()
fun box(): String {
val a = A()
val b = A()
a.addAll(b)
a.addAll(0, b)
a.removeAll(b)
a.retainAll(b)
a.clear()
a.add("")
a.set(0, "")
a.add(0, "")
a.removeAt(0)
a.remove("")
return "OK"
}
@@ -0,0 +1,18 @@
class A : HashMap<String, Double>()
fun box(): String {
val a = A()
val b = A()
a.put("", 0.0)
a.remove("")
a.putAll(b)
a.clear()
a.keys
a.values
a.entries
return "OK"
}
@@ -0,0 +1,18 @@
class A : HashSet<Long>()
fun box(): String {
val a = A()
val b = A()
a.iterator()
a.add(0L)
a.remove(0L)
a.addAll(b)
a.removeAll(b)
a.retainAll(b)
a.clear()
return "OK"
}
@@ -0,0 +1,30 @@
// TARGET_BACKEND: JVM
// FILE: Test.java
import java.lang.*;
import java.util.*;
public class Test {
public static class MapEntryImpl implements Map.Entry<String, String> {
public String getKey() { return null; }
public String getValue() { return null; }
public String setValue(String s) { return null; }
}
}
// FILE: main.kt
//class MyIterable : Test.IterableImpl()
//class MyIterator : Test.IteratorImpl()
class MyMapEntry : Test.MapEntryImpl()
fun box(): String {
val b = MyMapEntry()
b.key
b.value
b.setValue(null)
return "OK"
}
@@ -0,0 +1,53 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// FULL_JDK
// WITH_RUNTIME
interface ImmutableCollection<out E> : Collection<E> {
fun add(element: @UnsafeVariance E): ImmutableCollection<E>
fun addAll(elements: Collection<@UnsafeVariance E>): ImmutableCollection<E>
fun remove(element: @UnsafeVariance E): ImmutableCollection<E>
}
class ImmutableCollectionmpl<E> : ImmutableCollection<E> {
override val size: Int
get() = throw UnsupportedOperationException()
override fun contains(element: E): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun containsAll(elements: Collection<E>): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun isEmpty(): Boolean {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun iterator(): Iterator<E> {
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun add(element: E): ImmutableCollection<E> = this
override fun addAll(elements: Collection<E>): ImmutableCollection<E> = this
override fun remove(element: E): ImmutableCollection<E> = this
}
fun box(): String {
val c = ImmutableCollectionmpl<String>()
if (c.remove("") !== c) return "fail 1"
if (c.add("") !== c) return "fail 2"
if (c.addAll(java.util.ArrayList()) !== c) return "fail 3"
val method = c.javaClass.methods.single { it.name == "remove" && it.returnType == Boolean::class.javaPrimitiveType }
try {
method.invoke(c, "")
return "fail 4"
} catch (e: java.lang.reflect.InvocationTargetException) {
if (e.cause!!.message != "Operation is not supported for read-only collection") return "fail 5: ${e.cause!!.message}"
}
return "OK"
}
@@ -0,0 +1,32 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
interface Addable {
fun add(s: String): Boolean = true
}
class C : Addable, List<String> {
override val size: Int get() = null!!
override fun isEmpty(): Boolean = null!!
override fun contains(o: String): Boolean = null!!
override fun iterator(): Iterator<String> = null!!
override fun containsAll(c: Collection<String>): Boolean = null!!
override fun get(index: Int): String = null!!
override fun indexOf(o: String): Int = null!!
override fun lastIndexOf(o: String): Int = null!!
override fun listIterator(): ListIterator<String> = null!!
override fun listIterator(index: Int): ListIterator<String> = null!!
override fun subList(fromIndex: Int, toIndex: Int): List<String> = null!!
}
fun box(): String {
try {
val a = C()
if (!a.add("")) return "Fail 1"
if (!(a as Addable).add("")) return "Fail 2"
if (!(a as java.util.List<String>).add("")) return "Fail 3"
return "OK"
} catch (e: UnsupportedOperationException) {
return "Fail: no stub method should be generated"
}
}
@@ -0,0 +1,24 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
open class SetStringImpl {
fun add(s: String): Boolean = false
fun remove(o: String): Boolean = false
fun clear(): Unit {}
}
class S : Set<String>, SetStringImpl() {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: String): Boolean = false
override fun iterator(): Iterator<String> = null!!
override fun containsAll(c: Collection<String>) = false
}
fun box(): String {
val s = S() as java.util.Set<String>
s.add("")
s.remove("")
s.clear()
return "OK"
}
@@ -0,0 +1,33 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
class A<U : Number, V : U, W : V> : Set<W> {
override val size: Int get() = 0
override fun isEmpty(): Boolean = true
override fun contains(o: W): Boolean = false
override fun iterator(): Iterator<W> = emptySet<W>().iterator()
override fun containsAll(c: Collection<W>): Boolean = c.isEmpty()
}
fun expectUoe(block: () -> Any) {
try {
block()
throw AssertionError()
} catch (e: UnsupportedOperationException) {
}
}
fun box(): String {
val a = A<Int, Int, Int>() as java.util.Set<Int>
a.iterator()
expectUoe { a.add(42) }
expectUoe { a.remove(42) }
expectUoe { a.addAll(a) }
expectUoe { a.removeAll(a) }
expectUoe { a.retainAll(a) }
expectUoe { a.clear() }
return "OK"
}
@@ -0,0 +1,20 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyCollection<T> : Collection<List<Iterator<T>>> {
override fun iterator() = null!!
override val size: Int get() = null!!
override fun isEmpty(): Boolean = null!!
override fun contains(o: List<Iterator<T>>): Boolean = null!!
override fun containsAll(c: Collection<List<Iterator<T>>>): Boolean = null!!
}
fun box(): String {
val c = MyCollection<String>() as java.util.Collection<List<Iterator<String>>>
try {
c.add(ArrayList())
return "Fail"
} catch (e: UnsupportedOperationException) {
return "OK"
}
}
@@ -0,0 +1,16 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
class MyIterator<E : Number> : Iterator<E> {
override fun next() = null!!
override fun hasNext() = null!!
}
fun box(): String {
try {
(MyIterator<Int>() as java.util.Iterator<Number>).remove()
return "Fail"
} catch (e: UnsupportedOperationException) {
return "OK"
}
}
@@ -0,0 +1,31 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// FILE: Test.java
public class Test {
public static void checkCallFromJava() {
try {
String x = TestKt.foo().iterator().next();
throw new AssertionError("E should have been thrown");
} catch (E e) { }
}
}
// FILE: test.kt
interface MyIterable<T> : Iterable<T>
class E : RuntimeException()
fun foo(): MyIterable<String> = throw E()
fun box(): String {
try {
foo().iterator().next()
return "Fail: E should have been thrown"
} catch (e: E) {}
Test.checkCallFromJava()
return "OK"
}
@@ -0,0 +1,42 @@
// TODO: muted automatically, investigate should it be ran for JS or not
// IGNORE_BACKEND: JS
// FILE: Test.java
class Test {
interface A {
boolean add(String s);
}
static class D extends C {}
void test() {
A a = new D();
a.add("lol");
}
}
// FILE: test.kt
abstract class C : Test.A, List<String> {
override val size: Int get() = null!!
override fun isEmpty(): Boolean = null!!
override fun contains(o: String): Boolean = null!!
override fun iterator(): Iterator<String> = null!!
override fun containsAll(c: Collection<String>): Boolean = null!!
override fun get(index: Int): String = null!!
override fun indexOf(o: String): Int = null!!
override fun lastIndexOf(o: String): Int = null!!
override fun listIterator(): ListIterator<String> = null!!
override fun listIterator(index: Int): ListIterator<String> = null!!
override fun subList(fromIndex: Int, toIndex: Int): List<String> = null!!
}
fun box(): String {
try {
Test().test()
return "Fail"
} catch (e: UnsupportedOperationException) {
return "OK"
}
}