JS: do not use "-no-stdlib" in non-relevant tests

Rename some Ant tests: "simple[...]" -> "simpleWithoutStdlib[...]" and
"simpleWithStdlib[...]" -> "simple[...]"
This commit is contained in:
Alexander Udalov
2019-01-17 19:31:38 +01:00
parent 0659d0cba9
commit cb6fb78bc3
56 changed files with 34 additions and 53 deletions
@@ -0,0 +1,39 @@
(function(global) {
var modules = {};
modules.kotlin = kotlin;
// Hard-code expected dependency order since we are unable to refer to modules by filename here.
var names = ["jslib-example", "out"];
function define(name, dependencies, body) {
if (Array.isArray(name)) {
body = dependencies;
dependencies = name;
name = names.shift();
}
else {
if (name !== names.shift()) throw new Error("Unexpected dependency")
}
var resolvedDependencies = [];
var currentModule = {};
modules[name] = currentModule;
for (var i = 0; i < dependencies.length; ++i) {
var dependencyName = dependencies[i];
resolvedDependencies[i] = dependencyName === 'exports' ? currentModule : modules[dependencyName];
}
currentModule = body.apply(body, resolvedDependencies);
if (currentModule) {
modules[name] = currentModule;
}
}
define.amd = {};
function require(name) {
return modules[name];
}
global.define = define;
global.$kotlin_test_internal$ = {
require : require
};
})(this);
@@ -0,0 +1,14 @@
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]
[copy] Copying 1 file to [Temp]
BUILD SUCCESSFUL
Total time: [time]
Return code: 0
@@ -0,0 +1,23 @@
<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="true" moduleKind="umd"/>
<kotlin2js src="${test.data}/root1" output="${temp}/out.js" main="call" moduleKind="amd">
<libraries>
<pathelement path="${temp.library.path}/jslib-example.meta.js"/>
</libraries>
</kotlin2js>
<copy todir="${temp}">
<fileset dir="${temp.library.path}">
<include name="**/*.js"/>
<exclude name="META-INF/**"/>
</fileset>
</copy>
<copy todir="${temp}" file="${test.data}/amd.js"/>
</target>
</project>
@@ -0,0 +1,9 @@
package library.sample
import kotlin.js.Date
public class ClassA() {
val value: Int = 100
}
public fun Date.extFun(): Int = 100
@@ -0,0 +1,17 @@
package foo
import library.sample.*
import kotlin.js.Date
var ok = "FAIL"
fun main() {
val x = ClassA().value
if (x == 100) {
ok = "OK"
}
val date = Date()
println(date.extFun())
}
fun box(): String = ok