Supporting data class for JS backend
This commit is contained in:
committed by
Zalim Bashorov
parent
535cc3eed8
commit
ab81d2e261
@@ -0,0 +1,24 @@
|
||||
package foo
|
||||
|
||||
data class Dat(val start: String, middle: String, val end: String) {
|
||||
fun getLabel() : String {
|
||||
return start + end
|
||||
}
|
||||
}
|
||||
|
||||
fun assertEquals<T>(expected: T, actual: T) {
|
||||
if (expected != actual) throw Exception("expected: $expected, actual, $actual")
|
||||
}
|
||||
|
||||
fun assertNotEqual<T>(expected: T, actual: T) {
|
||||
if (expected == actual) throw Exception("unexpectedly equal: $expected and $actual")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val d = Dat("max", "-", "min")
|
||||
assertEquals("maxmin", d.getLabel())
|
||||
val (p1, p2) = d
|
||||
assertEquals("max", p1)
|
||||
assertEquals("min", p2)
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user