JS: tests for KT-7357: extension functions from external KJS library couldn't be called in some cases
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
OUT:
|
||||
Buildfile: [TestData]/build.xml
|
||||
|
||||
build:
|
||||
[mkdir] Created dir: [Temp]/lib
|
||||
[kotlin2js] Compiling [[TestData]/jslib-example] => [[Temp]/lib/jslib-example.js]
|
||||
[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
|
||||
[copy] Copying 2 files to [Temp]
|
||||
|
||||
BUILD SUCCESSFUL
|
||||
Total time: [time]
|
||||
|
||||
Return code: 0
|
||||
@@ -0,0 +1,22 @@
|
||||
<project name="Ant Task Test" default="build">
|
||||
<taskdef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/>
|
||||
<property name="library.path" value="${test.data}/jslib-example"/>
|
||||
<property name="temp.library.path" value="${temp}/lib"/>
|
||||
<target name="build">
|
||||
<mkdir dir="${temp.library.path}"/>
|
||||
|
||||
<kotlin2js src="${library.path}" output="${temp.library.path}/jslib-example.js" metaInfo="${temp.library.path}/jslib-example.meta.js"/>
|
||||
|
||||
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" main="call">
|
||||
<library>
|
||||
<pathelement path="${temp.library.path}/jslib-example.meta.js"/>
|
||||
</library>
|
||||
</kotlin2js>
|
||||
<copy todir="${temp}">
|
||||
<fileset dir="${temp.library.path}">
|
||||
<include name="**/*.js"/>
|
||||
<exclude name="META-INF/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</project>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package library.sample
|
||||
|
||||
import kotlin.js.Date
|
||||
|
||||
public class ClassA() {
|
||||
val value: Int = 100
|
||||
}
|
||||
|
||||
public fun Date.extFun(): Int = 100
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package foo
|
||||
|
||||
import library.sample.*
|
||||
import kotlin.js.Date
|
||||
|
||||
var ok = "FAIL"
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x = ClassA().value
|
||||
if (x == 100) {
|
||||
ok = "OK"
|
||||
}
|
||||
val date = Date()
|
||||
println(date.extFun())
|
||||
}
|
||||
|
||||
fun box(): String = ok
|
||||
Reference in New Issue
Block a user