diff --git a/build.xml b/build.xml index c962fba9534..9b0d02963b6 100644 --- a/build.xml +++ b/build.xml @@ -307,6 +307,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ): Int = p.first + p.second + +public fun pairMul(p: Pair): Int = p.first * p.second + +public data class IntHolder(val value: Int) + diff --git a/compiler/testData/cli/js/withFolderAsLib.args b/compiler/testData/cli/js/withFolderAsLib.args new file mode 100644 index 00000000000..0dcea39b299 --- /dev/null +++ b/compiler/testData/cli/js/withFolderAsLib.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/withLib.kt +-library-files +dist/jslib-example +-output +$TEMP_DIR$/out.js diff --git a/compiler/testData/cli/js/withFolderAsLib.out b/compiler/testData/cli/js/withFolderAsLib.out new file mode 100644 index 00000000000..d86bac9de59 --- /dev/null +++ b/compiler/testData/cli/js/withFolderAsLib.out @@ -0,0 +1 @@ +OK diff --git a/compiler/testData/cli/js/withLib.args b/compiler/testData/cli/js/withLib.args new file mode 100644 index 00000000000..ae65dafb653 --- /dev/null +++ b/compiler/testData/cli/js/withLib.args @@ -0,0 +1,5 @@ +$TESTDATA_DIR$/withLib.kt +-library-files +dist/jslib-example.jar +-output +$TEMP_DIR$/out.js diff --git a/compiler/testData/cli/js/withLib.kt b/compiler/testData/cli/js/withLib.kt new file mode 100644 index 00000000000..2c8fbaadc4c --- /dev/null +++ b/compiler/testData/cli/js/withLib.kt @@ -0,0 +1,8 @@ +import kotlin.Pair +import library.sample.* + +fun main(args: Array) { + val p = Pair(10, 20) + val x = pairAdd(p) + println("x=$x") +} \ No newline at end of file diff --git a/compiler/testData/cli/js/withLib.out b/compiler/testData/cli/js/withLib.out new file mode 100644 index 00000000000..d86bac9de59 --- /dev/null +++ b/compiler/testData/cli/js/withLib.out @@ -0,0 +1 @@ +OK diff --git a/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java b/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java index eb5c8b2dd6d..adb9d8f4954 100644 --- a/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/cli/KotlincExecutableTestGenerated.java @@ -203,5 +203,17 @@ public class KotlincExecutableTestGenerated extends AbstractKotlincExecutableTes String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/suppressAllWarningsJS.args"); doJsTest(fileName); } + + @TestMetadata("withFolderAsLib.args") + public void testWithFolderAsLib() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/withFolderAsLib.args"); + doJsTest(fileName); + } + + @TestMetadata("withLib.args") + public void testWithLib() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/cli/js/withLib.args"); + doJsTest(fileName); + } } } diff --git a/compiler/tests/org/jetbrains/jet/cli/js/K2JsCliTest.java b/compiler/tests/org/jetbrains/jet/cli/js/K2JsCliTest.java index b582db0fe83..12a1dafbdf9 100644 --- a/compiler/tests/org/jetbrains/jet/cli/js/K2JsCliTest.java +++ b/compiler/tests/org/jetbrains/jet/cli/js/K2JsCliTest.java @@ -62,4 +62,18 @@ public class K2JsCliTest extends CliBaseTest { Assert.assertTrue(new File(tmpdir.getTmpDir(), "out.js").isFile()); } + + @Test + public void withLib() throws Exception { + executeCompilerCompareOutputJS(); + + Assert.assertTrue(new File(tmpdir.getTmpDir(), "out.js").isFile()); + } + + @Test + public void withFolderAsLib() throws Exception { + executeCompilerCompareOutputJS(); + + Assert.assertTrue(new File(tmpdir.getTmpDir(), "out.js").isFile()); + } }