KT-12877: reorganize JS module tests to support different module systems. Test JsModule in conjunction with JsNonModule and plain module type

This commit is contained in:
Alexey Andreev
2016-07-04 15:32:02 +03:00
committed by Alexey Andreev
parent 0238b182cc
commit 08a7f9c298
9 changed files with 30 additions and 84 deletions
@@ -0,0 +1,3 @@
function foo(y) {
return 23 + y;
}
@@ -0,0 +1,10 @@
package foo
@JsModule("lib")
@JsNonModule
@native fun foo(y: Int): Int = noImpl
fun box(): String {
assertEquals(65, foo(42))
return "OK"
}
@@ -1,18 +0,0 @@
@file:JsModule("lib")
package foo
@native class A(@native val x: Int = noImpl) {
@native fun foo(y: Int): Int = noImpl
}
@native object B {
@native val x: Int = noImpl
@native fun foo(y: Int): Int = noImpl
}
@native fun foo(y: Int): Int = noImpl
@native val bar: Int = noImpl
@native var mbar: Int = noImpl
@@ -1,20 +0,0 @@
package foo
fun box(): String {
val a = A(23)
assertEquals(23, a.x)
assertEquals(65, a.foo(42))
assertEquals(123, B.x)
assertEquals(265, B.foo(142))
assertEquals(365, foo(42))
assertEquals(423, bar)
assertEquals(12345, C.f())
mbar = 523
assertEquals(523, mbar)
return "OK"
}
@@ -1,2 +0,0 @@
lib->
main->lib
@@ -1,18 +0,0 @@
@file:JsModule("native-lib")
package foo
@native class A(@native val x: Int = noImpl) {
@native fun foo(y: Int): Int = noImpl
}
@native object B {
@native val x: Int = noImpl
@native fun foo(y: Int): Int = noImpl
}
@native fun foo(y: Int): Int = noImpl
@native val bar: Int = noImpl
@native var mbar: Int = noImpl
@@ -1,18 +0,0 @@
package foo
fun box(): String {
val a = A(23)
assertEquals(23, a.x)
assertEquals(65, a.foo(42))
assertEquals(123, B.x)
assertEquals(265, B.foo(142))
assertEquals(365, foo(42))
assertEquals(423, bar)
mbar = 523
assertEquals(523, mbar)
return "OK"
}