[JS IR] Add test with member with JsName and default argument

^KT-44796 fixed
This commit is contained in:
Ilya Goncharov
2021-03-29 15:45:22 +03:00
committed by TeamCityServer
parent a7f8f0d903
commit 30a024d05d
2 changed files with 15 additions and 1 deletions
@@ -7,6 +7,7 @@ module.exports = function() {
var transform = api.transform;
var Ping = api.Ping;
var Pong = api.Pong;
var Foo = api.Foo;
return {
"ping00": ping(),
@@ -26,7 +27,8 @@ module.exports = function() {
"Ping_ping00b": new Ping(10).ping(),
"Ping_ping11": new Ping().ping(-4, function(it) { return it * it * it }),
"Pong_ping00": new Pong().ping()
"Pong_ping00": new Pong().ping(),
"Foo": new Foo().foo()
};
};
@@ -25,6 +25,12 @@ fun bing(a: String = "A", b: Int = 1): String {
return "$b::$a"
}
@JsExport
class Foo {
@JsName("foo")
fun value(value: Long = 5L) = if (value == 5L) "C" else "fail"
}
@JsExport
fun transform(i: Int = 10, t: (Int) -> Int = {it * it}): Int {
return t(i)
@@ -49,6 +55,8 @@ external interface JsResult {
val Ping_ping11: Int
val Pong_ping00: Int
val Foo: String
}
@JsModule("lib")
@@ -102,5 +110,9 @@ fun box(): String {
return "fail13: ${res.Pong_ping00}"
}
if (res.Foo != "C") {
return "fail14: ${res.Foo}"
}
return "OK"
}