Minor. Add more tests
This commit is contained in:
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// LANGUAGE: +ValueClasses, +GenericInlineClassParameter
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class Z<T: Int>(val int: T)
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class L<T: Long>(val long: T)
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class Str<T: String>(val string: T)
|
||||
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class Obj<T: Any>(val obj: T)
|
||||
|
||||
fun box(): String {
|
||||
var xz = Z(0)
|
||||
var xl = L(0L)
|
||||
var xs = Str("")
|
||||
var xo = Obj("")
|
||||
|
||||
val fn = {
|
||||
xz = Z(42)
|
||||
xl = L(1234L)
|
||||
xs = Str("abc")
|
||||
xo = Obj("def")
|
||||
}
|
||||
fn()
|
||||
|
||||
if (xz.int != 42) throw AssertionError()
|
||||
if (xl.long != 1234L) throw AssertionError()
|
||||
if (xs.string != "abc") throw AssertionError()
|
||||
if (xo.obj != "def") throw AssertionError()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user