JS backend: add cli test for creating metadata and ant test for library with metadata
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
compiler/testData/integration/ant/js/simpleWithoutStdlibAndFolderAsAnotherLib/jslib-example/LibraryExample.kt
|
||||
-no-stdlib
|
||||
-meta-info
|
||||
$TEMP_DIR$/jslib-example.meta.js
|
||||
-output
|
||||
$TEMP_DIR$/jslib-example.js
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
+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
|
||||
+22
@@ -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}"/>
|
||||
</library>
|
||||
</kotlin2js>
|
||||
<copy todir="${temp}">
|
||||
<fileset dir="${temp.library.path}">
|
||||
<include name="**/*.js"/>
|
||||
<exclude name="META-INF/**"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
</project>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package library.sample
|
||||
|
||||
public class ClassA() {
|
||||
val value: Int = 100
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
Manifest-Version: 1.0
|
||||
Ant-Version: Apache Ant 1.9.1
|
||||
Created-By: 1.7.0_72-b14 (Oracle Corporation)
|
||||
Built-By: JetBrains
|
||||
Implementation-Vendor: JetBrains
|
||||
Implementation-Version: snapshot
|
||||
Specification-Title: Kotlin JavaScript Lib
|
||||
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package foo
|
||||
|
||||
import library.sample.*
|
||||
|
||||
var ok = "FAIL"
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x = ClassA().value
|
||||
if (x == 100) {
|
||||
ok = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String = ok
|
||||
@@ -183,6 +183,12 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cli/js"), Pattern.compile("^(.+)\\.args$"), false);
|
||||
}
|
||||
|
||||
@TestMetadata("createMetadata.args")
|
||||
public void testCreateMetadata() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/createMetadata.args");
|
||||
doJsTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("diagnosticForClassLiteral.args")
|
||||
public void testDiagnosticForClassLiteral() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/diagnosticForClassLiteral.args");
|
||||
|
||||
@@ -70,6 +70,14 @@ public class K2JsCliTest extends CliBaseTest {
|
||||
Assert.assertTrue(new File(tmpdir.getTmpDir(), "out.js").isFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createMetadata() throws Exception {
|
||||
executeCompilerCompareOutputJS();
|
||||
|
||||
Assert.assertTrue(new File(tmpdir.getTmpDir(), "jslib-example.meta.js").isFile());
|
||||
Assert.assertTrue(new File(tmpdir.getTmpDir(), "jslib-example.js").isFile());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void libraryDirNotFound() throws Exception {
|
||||
executeCompilerCompareOutputJS();
|
||||
|
||||
@@ -112,6 +112,11 @@ public class AntTaskJsTest extends AntTaskBaseTest {
|
||||
doJsAntTest("jslib-example.js");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleWithoutStdlibAndFolderAsAnotherLib() throws Exception {
|
||||
doJsAntTest("jslib-example.js");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleWithMainFQArgs() throws Exception {
|
||||
doJsAntTest();
|
||||
|
||||
Reference in New Issue
Block a user