diff --git a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JsEnvironmentConfigurationDirectives.kt b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JsEnvironmentConfigurationDirectives.kt index d633401e205..b914f249ed4 100644 --- a/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JsEnvironmentConfigurationDirectives.kt +++ b/compiler/tests-common-new/tests/org/jetbrains/kotlin/test/directives/JsEnvironmentConfigurationDirectives.kt @@ -134,6 +134,12 @@ object JsEnvironmentConfigurationDirectives : SimpleDirectivesContainer() { applicability = DirectiveApplicability.Global, ) + val MAIN_ARGS by valueDirective( + description = "Specify arguments that will be passes to main fun", + applicability = DirectiveApplicability.Global, + parser = { it.subSequence(1, it.length - 1).split(",") } + ) + // Next directives are used only inside test system and must not be present in test file val PATH_TO_TEST_DIR by stringDirective( diff --git a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt index 75ab19dca00..4352cf79c7c 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/generators/tests/GenerateJsTests.kt @@ -15,11 +15,11 @@ import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrJsCodegenBoxES6Test import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrJsCodegenInlineES6Test import org.jetbrains.kotlin.js.test.es6.semantics.AbstractIrJsTypeScriptExportES6Test import org.jetbrains.kotlin.js.test.ir.semantics.* -import org.jetbrains.kotlin.js.test.semantics.* import org.jetbrains.kotlin.js.test.wasm.semantics.AbstractIrCodegenBoxWasmTest import org.jetbrains.kotlin.js.test.wasm.semantics.AbstractIrCodegenWasmJsInteropWasmTest import org.jetbrains.kotlin.js.test.wasm.semantics.AbstractJsTranslatorWasmTest import org.jetbrains.kotlin.js.testNew.* +import org.jetbrains.kotlin.js.testNew.AbstractWebDemoExamplesTest import org.jetbrains.kotlin.test.TargetBackend fun main(args: Array) { @@ -137,6 +137,10 @@ fun main(args: Array) { testClass { model("multiModuleOrder/") } + + testClass { + model("webDemoExamples/") + } } testGroup("js/js.tests/tests-gen", "compiler/testData", testRunnerMethodName = "runTest0") { diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt deleted file mode 100644 index 0c42c7c4567..00000000000 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/AbstractWebDemoExamplesTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.js.test.semantics - -import com.google.common.collect.Lists -import com.intellij.openapi.util.text.StringUtil -import org.jetbrains.kotlin.js.facade.MainCallParameters -import org.jetbrains.kotlin.js.test.BasicBoxTest -import java.io.File -import javax.script.ScriptException - -abstract class AbstractWebDemoExamplesTest(relativePath: String) : BasicBoxTest( - BasicBoxTest.TEST_DATA_DIR_PATH + "/$relativePath/", - relativePath, - generateNodeJsRunner = false -) { - override fun runGeneratedCode( - jsFiles: List, - testModuleName: String?, - testPackage: String?, - testFunction: String, - expectedResult: String, - withModuleSystem: Boolean - ) { - testChecker.checkStdout(jsFiles, expectedResult) - } - - @Throws(ScriptException::class) - protected fun runMainAndCheckOutput(fileName: String, expectedResult: String, vararg args: String) { - doTest(pathToTestDir + fileName, expectedResult, MainCallParameters.mainWithArguments(Lists.newArrayList(*args))) - } - - protected fun runMainAndCheckOutputWithExpectedFile(testName: String, testId: String, vararg args: String) { - val expectedResult = StringUtil.convertLineSeparators(File(pathToTestDir + testName + testId + ".out").readText()) - doTest(pathToTestDir + testName + ".kt", expectedResult, MainCallParameters.mainWithArguments(Lists.newArrayList(*args))) - } -} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoExamples1Test.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoExamples1Test.java deleted file mode 100644 index b42dea9fc7b..00000000000 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoExamples1Test.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.js.test.semantics; - -public final class WebDemoExamples1Test extends AbstractWebDemoExamplesTest { - - public WebDemoExamples1Test() { - super("webDemoExamples1/"); - } - - public void testPrintArg() throws Exception { - runMainAndCheckOutput("printArg.kt", "Hello, world!", "Hello, world!"); - } - - - public void testWhileLoop() throws Exception { - runMainAndCheckOutput("whileLoop.kt", "guest1\nguest2\nguest3\nguest4\n", "guest1", "guest2", "guest3", "guest4"); - } - - - public void testIfAsExpression() throws Exception { - runMainAndCheckOutput("ifAsExpression.kt", "20\n", "10", "20"); - } - - - public void testObjectOrientedHello() throws Exception { - runMainAndCheckOutput("objectOrientedHello.kt", "Hello, Pavel!\n", "Pavel"); - } - - - public void testMultiLanguageHello() throws Exception { - runMainAndCheckOutput("multiLanguageHello.kt", "Salut!\n", "FR"); - } - - - public void testNullChecks() throws Exception { - runMainAndCheckOutput("nullChecks.kt", "No number supplied"); - runMainAndCheckOutput("nullChecks.kt", "6", "2", "3"); - } - - - public void testRanges() throws Exception { - runMainAndCheckOutput("ranges.kt", "OK\n" + - " 1 2 3 4 5\n" + - "Out: array has only 3 elements. x = 4\n" + - "Yes: array contains aaa\n" + - "No: array doesn't contains ddd\n", "4"); - - runMainAndCheckOutput("ranges.kt", " 1 2 3 4 5\n" + - "Out: array has only 3 elements. x = 10\n" + - "Yes: array contains aaa\n" + - "No: array doesn't contains ddd\n", "10"); - } - - - public void testForLoop() throws Exception { - runMainAndCheckOutput("forLoop.kt", "a\n" + - "b\n" + - "c\n" + - "\n" + - "a\n" + - "b\n" + - "c\n", "a", "b", "c"); - runMainAndCheckOutput("forLoop.kt", "123\n\n123\n", "123"); - } - - - public void testIsCheck() throws Exception { - runMainAndCheckOutput("isCheck.kt", "3\nnull\n"); - } - - - public void testPatternMatching() throws Exception { - runMainAndCheckOutput("patternMatching.kt", "Greeting\n" + - "One\n" + - "Not a string\n" + - "Unknown\n"); - } -} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoExamples2Test.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoExamples2Test.java deleted file mode 100644 index b9bd9a2e073..00000000000 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/WebDemoExamples2Test.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.js.test.semantics; - -public final class WebDemoExamples2Test extends AbstractWebDemoExamplesTest { - - public WebDemoExamples2Test() { - super("webDemoExamples2/"); - } - - public void testBottles() throws Exception { - runMainAndCheckOutputWithExpectedFile("bottles", "2", "2"); - runMainAndCheckOutputWithExpectedFile("bottles", ""); - } - - public void testLife() throws Exception { - runMainAndCheckOutputWithExpectedFile("life", "", "2"); - } - - public void testBuilder() throws Exception { - runMainAndCheckOutputWithExpectedFile("builder", ""); - runMainAndCheckOutputWithExpectedFile("builder", "1", "over9000"); - } -} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testNew/AbstractJsTest.kt b/js/js.tests/test/org/jetbrains/kotlin/js/testNew/AbstractJsTest.kt index 36d2653566b..264ae007eb4 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/testNew/AbstractJsTest.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/testNew/AbstractJsTest.kt @@ -136,3 +136,22 @@ open class AbstractMultiModuleOrderTest : AbstractJsTest( } } } + +open class AbstractWebDemoExamplesTest : AbstractJsTest( + pathToTestDir = "${JsEnvironmentConfigurator.TEST_DATA_DIR_PATH}/webDemoExamples/", + testGroupOutputDirPrefix = "webDemoExamples/" +) { + override fun configure(builder: TestConfigurationBuilder) { + super.configure(builder) + with(builder) { + defaultDirectives { + -JsEnvironmentConfigurationDirectives.GENERATE_NODE_JS_RUNNER + JsEnvironmentConfigurationDirectives.DONT_RUN_GENERATED_CODE.with("JS") + } + + configureJsArtifactsHandlersStep { + useHandlers(::MainCallWithArgumentsHandler) + } + } + } +} diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testNew/converters/ClassicJsBackendFacade.kt b/js/js.tests/test/org/jetbrains/kotlin/js/testNew/converters/ClassicJsBackendFacade.kt index 7ead465868c..536d24770d2 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/testNew/converters/ClassicJsBackendFacade.kt +++ b/js/js.tests/test/org/jetbrains/kotlin/js/testNew/converters/ClassicJsBackendFacade.kt @@ -5,6 +5,7 @@ package org.jetbrains.kotlin.js.testNew.converters +import com.google.common.collect.Lists import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil import org.jetbrains.kotlin.cli.common.output.writeAllTo @@ -82,8 +83,11 @@ class ClassicJsBackendFacade( val units = unitsByPath.entries.sortedBy { it.key }.map { it.value } - val mainCallParameters = when (JsEnvironmentConfigurationDirectives.CALL_MAIN) { - in module.directives -> MainCallParameters.mainWithArguments(listOf()) + val mainCallParameters = when { + JsEnvironmentConfigurationDirectives.CALL_MAIN in module.directives -> MainCallParameters.mainWithArguments(listOf()) + JsEnvironmentConfigurationDirectives.MAIN_ARGS in module.directives -> { + MainCallParameters.mainWithArguments(module.directives[JsEnvironmentConfigurationDirectives.MAIN_ARGS].first()) + } else -> MainCallParameters.noCall() } diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/testNew/handlers/MainCallWithArgumentsHandler.kt b/js/js.tests/test/org/jetbrains/kotlin/js/testNew/handlers/MainCallWithArgumentsHandler.kt new file mode 100644 index 00000000000..080b1b73ae9 --- /dev/null +++ b/js/js.tests/test/org/jetbrains/kotlin/js/testNew/handlers/MainCallWithArgumentsHandler.kt @@ -0,0 +1,26 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.js.testNew.handlers + +import org.jetbrains.kotlin.js.testNew.utils.getOnlyJsFilesForRunner +import org.jetbrains.kotlin.js.testNew.utils.getTestChecker +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.moduleStructure + +class MainCallWithArgumentsHandler(testServices: TestServices) : AbstractJsArtifactsCollector(testServices) { + override fun processAfterAllModules(someAssertionWasFailed: Boolean) { + if (someAssertionWasFailed) return + + val testFile = testServices.moduleStructure.originalTestDataFiles.first() + val expectedFile = testFile.parentFile.resolve(testFile.nameWithoutExtension + ".out") + if (!expectedFile.exists()) { + throw IllegalArgumentException("File ${expectedFile.absolutePath} with expected result doesn't exists") + } + val allJsFiles = getOnlyJsFilesForRunner(testServices, modulesToArtifact) + + getTestChecker(testServices).checkStdout(allJsFiles, expectedFile.readText()) + } +} \ No newline at end of file diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/WebDemoExamplesTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/WebDemoExamplesTestGenerated.java new file mode 100644 index 00000000000..02745fffe5d --- /dev/null +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/testNew/WebDemoExamplesTestGenerated.java @@ -0,0 +1,129 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.js.testNew; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("js/js.translator/testData/webDemoExamples") +@TestDataPath("$PROJECT_ROOT") +public class WebDemoExamplesTestGenerated extends AbstractWebDemoExamplesTest { + @Test + public void testAllFilesPresentInWebDemoExamples() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/webDemoExamples"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + + @Test + @TestMetadata("bottles.kt") + public void testBottles() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/bottles.kt"); + } + + @Test + @TestMetadata("builder.kt") + public void testBuilder() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/builder.kt"); + } + + @Test + @TestMetadata("forLoop1.kt") + public void testForLoop1() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/forLoop1.kt"); + } + + @Test + @TestMetadata("forLoop2.kt") + public void testForLoop2() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/forLoop2.kt"); + } + + @Test + @TestMetadata("ifAsExpression.kt") + public void testIfAsExpression() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/ifAsExpression.kt"); + } + + @Test + @TestMetadata("isCheck.kt") + public void testIsCheck() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/isCheck.kt"); + } + + @Test + @TestMetadata("life.kt") + public void testLife() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/life.kt"); + } + + @Test + @TestMetadata("maze.kt") + public void testMaze() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/maze.kt"); + } + + @Test + @TestMetadata("multiLanguageHello.kt") + public void testMultiLanguageHello() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/multiLanguageHello.kt"); + } + + @Test + @TestMetadata("nullChecks1.kt") + public void testNullChecks1() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/nullChecks1.kt"); + } + + @Test + @TestMetadata("nullChecks2.kt") + public void testNullChecks2() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/nullChecks2.kt"); + } + + @Test + @TestMetadata("objectOrientedHello.kt") + public void testObjectOrientedHello() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/objectOrientedHello.kt"); + } + + @Test + @TestMetadata("patternMatching.kt") + public void testPatternMatching() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/patternMatching.kt"); + } + + @Test + @TestMetadata("printArg.kt") + public void testPrintArg() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/printArg.kt"); + } + + @Test + @TestMetadata("ranges1.kt") + public void testRanges1() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/ranges1.kt"); + } + + @Test + @TestMetadata("ranges2.kt") + public void testRanges2() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/ranges2.kt"); + } + + @Test + @TestMetadata("whileLoop.kt") + public void testWhileLoop() throws Exception { + runTest("js/js.translator/testData/webDemoExamples/whileLoop.kt"); + } +} diff --git a/js/js.translator/testData/webDemoExamples2/bottles.kt b/js/js.translator/testData/webDemoExamples/bottles.kt similarity index 99% rename from js/js.translator/testData/webDemoExamples2/bottles.kt rename to js/js.translator/testData/webDemoExamples/bottles.kt index 1b41b065048..733b6c9d4b8 100644 --- a/js/js.translator/testData/webDemoExamples2/bottles.kt +++ b/js/js.translator/testData/webDemoExamples/bottles.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [2] + /** * This example implements the famous "99 Bottles of Beer" program * See http://99-bottles-of-beer.net/ diff --git a/js/js.translator/testData/webDemoExamples2/bottles2.out b/js/js.translator/testData/webDemoExamples/bottles.out similarity index 100% rename from js/js.translator/testData/webDemoExamples2/bottles2.out rename to js/js.translator/testData/webDemoExamples/bottles.out diff --git a/js/js.translator/testData/webDemoExamples2/builder.kt b/js/js.translator/testData/webDemoExamples/builder.kt similarity index 99% rename from js/js.translator/testData/webDemoExamples2/builder.kt rename to js/js.translator/testData/webDemoExamples/builder.kt index 9dcb694010b..e06cafa0f58 100644 --- a/js/js.translator/testData/webDemoExamples2/builder.kt +++ b/js/js.translator/testData/webDemoExamples/builder.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [over9000] + /** * This is an example of a Type-Safe Groovy-style Builder * diff --git a/js/js.translator/testData/webDemoExamples2/builder1.out b/js/js.translator/testData/webDemoExamples/builder.out similarity index 100% rename from js/js.translator/testData/webDemoExamples2/builder1.out rename to js/js.translator/testData/webDemoExamples/builder.out diff --git a/js/js.translator/testData/webDemoExamples/forLoop1.kt b/js/js.translator/testData/webDemoExamples/forLoop1.kt new file mode 100644 index 00000000000..8e27e2cb8c9 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/forLoop1.kt @@ -0,0 +1,11 @@ +// MAIN_ARGS: [a,b,c] + +fun main(args: Array) { + for (arg in args) + println(arg) + + // or + println() + for (i in args.indices) + println(args[i]) +} diff --git a/js/js.translator/testData/webDemoExamples/forLoop1.out b/js/js.translator/testData/webDemoExamples/forLoop1.out new file mode 100644 index 00000000000..4a1b8f2a216 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/forLoop1.out @@ -0,0 +1,7 @@ +a +b +c + +a +b +c diff --git a/js/js.translator/testData/webDemoExamples1/forLoop.kt b/js/js.translator/testData/webDemoExamples/forLoop2.kt similarity index 88% rename from js/js.translator/testData/webDemoExamples1/forLoop.kt rename to js/js.translator/testData/webDemoExamples/forLoop2.kt index 5707136f8aa..78fc9e4a56d 100644 --- a/js/js.translator/testData/webDemoExamples1/forLoop.kt +++ b/js/js.translator/testData/webDemoExamples/forLoop2.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [123] + fun main(args: Array) { for (arg in args) println(arg) diff --git a/js/js.translator/testData/webDemoExamples/forLoop2.out b/js/js.translator/testData/webDemoExamples/forLoop2.out new file mode 100644 index 00000000000..2f70f481c67 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/forLoop2.out @@ -0,0 +1,3 @@ +123 + +123 diff --git a/js/js.translator/testData/webDemoExamples1/ifAsExpression.kt b/js/js.translator/testData/webDemoExamples/ifAsExpression.kt similarity index 79% rename from js/js.translator/testData/webDemoExamples1/ifAsExpression.kt rename to js/js.translator/testData/webDemoExamples/ifAsExpression.kt index 2656e0986c9..1c6424693ff 100644 --- a/js/js.translator/testData/webDemoExamples1/ifAsExpression.kt +++ b/js/js.translator/testData/webDemoExamples/ifAsExpression.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [10,20] + fun main(args: Array) { println(maxOf(args[0].toInt(), args[1].toInt())) } diff --git a/js/js.translator/testData/webDemoExamples/ifAsExpression.out b/js/js.translator/testData/webDemoExamples/ifAsExpression.out new file mode 100644 index 00000000000..209e3ef4b62 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/ifAsExpression.out @@ -0,0 +1 @@ +20 diff --git a/js/js.translator/testData/webDemoExamples1/isCheck.kt b/js/js.translator/testData/webDemoExamples/isCheck.kt similarity index 92% rename from js/js.translator/testData/webDemoExamples1/isCheck.kt rename to js/js.translator/testData/webDemoExamples/isCheck.kt index 77f5b7e3e1e..7ec8d648ffd 100644 --- a/js/js.translator/testData/webDemoExamples1/isCheck.kt +++ b/js/js.translator/testData/webDemoExamples/isCheck.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [] + fun main(args: Array) { println(getStringLength("aaa")) println(getStringLength(1)) diff --git a/js/js.translator/testData/webDemoExamples/isCheck.out b/js/js.translator/testData/webDemoExamples/isCheck.out new file mode 100644 index 00000000000..6b6655236cc --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/isCheck.out @@ -0,0 +1,2 @@ +3 +null diff --git a/js/js.translator/testData/webDemoExamples2/life.kt b/js/js.translator/testData/webDemoExamples/life.kt similarity index 99% rename from js/js.translator/testData/webDemoExamples2/life.kt rename to js/js.translator/testData/webDemoExamples/life.kt index 124c5a92788..9360ed67a89 100644 --- a/js/js.translator/testData/webDemoExamples2/life.kt +++ b/js/js.translator/testData/webDemoExamples/life.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [2] + /** * This is a straightforward implementation of The Game of Life * See http://en.wikipedia.org/wiki/Conway's_Game_of_Life diff --git a/js/js.translator/testData/webDemoExamples2/life.out b/js/js.translator/testData/webDemoExamples/life.out similarity index 100% rename from js/js.translator/testData/webDemoExamples2/life.out rename to js/js.translator/testData/webDemoExamples/life.out diff --git a/js/js.translator/testData/webDemoExamples2/maze.kt b/js/js.translator/testData/webDemoExamples/maze.kt similarity index 71% rename from js/js.translator/testData/webDemoExamples2/maze.kt rename to js/js.translator/testData/webDemoExamples/maze.kt index bfc1caa7ea4..af0acd5051c 100644 --- a/js/js.translator/testData/webDemoExamples2/maze.kt +++ b/js/js.translator/testData/webDemoExamples/maze.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [] + /** * Let's Walk Through a Maze. * @@ -19,16 +21,19 @@ * as I possibly can by finding a shortest path through the maze. */ +fun MutableList.offer(element: E) = this.add(element) +fun MutableList.poll() = this.removeAt(0) + /** * This function looks for a path from max.start to maze.end through * free space (a path does not go through walls). One can move only * straightly up, down, left or right, no diagonal moves allowed. */ fun findPath(maze: Maze): List>? { - val previous = HashMap, Pair> + val previous = HashMap, Pair>() - val queue = LinkedList> - val visited = HashSet> + val queue = ArrayDeque>() + val visited = HashSet>() queue.offer(maze.start) visited.add(maze.start) @@ -36,7 +41,7 @@ fun findPath(maze: Maze): List>? { val cell = queue.poll() if (cell == maze.end) break - for (newCell in maze.neighbors(cell._1, cell._2)) { + for (newCell in maze.neighbors(cell.first, cell.second)) { if (newCell in visited) continue previous[newCell] = cell queue.offer(newCell) @@ -49,7 +54,7 @@ fun findPath(maze: Maze): List>? { val path = ArrayList>() var current = previous[maze.end] while (current != maze.start) { - path.add(0, current) + path.add(0, current!!) current = previous[current] } return path @@ -59,7 +64,7 @@ fun findPath(maze: Maze): List>? { * Find neighbors of the (i, j) cell that are not walls */ fun Maze.neighbors(i: Int, j: Int): List> { - val result = ArrayList> + val result = ArrayList>() addIfFree(i - 1, j, result) addIfFree(i, j - 1, result) addIfFree(i + 1, j, result) @@ -67,7 +72,7 @@ fun Maze.neighbors(i: Int, j: Int): List> { return result } -fun Maze.addIfFree(i: Int, j: Int, result: List>) { +fun Maze.addIfFree(i: Int, j: Int, result: MutableList>) { if (i !in 0..height - 1) return if (j !in 0..width - 1) return if (walls[i][j]) return @@ -79,16 +84,16 @@ fun Maze.addIfFree(i: Int, j: Int, result: List>) { * A data class that represents a maze */ class Maze( - // Number or columns - val width: Int, - // Number of rows - val height: Int, - // true for a wall, false for free space - val walls: Array>, - // The starting point (must not be a wall) - val start: Pair, - // The target point (must not be a wall) - val end: Pair + // Number or columns + val width: Int, + // Number of rows + val height: Int, + // true for a wall, false for free space + val walls: Array>, + // The starting point (must not be a wall) + val start: Pair, + // The target point (must not be a wall) + val end: Pair ) { } @@ -102,7 +107,7 @@ fun main(args: Array) { O O O I - """) + """.trimIndent()) printMaze(""" OOOOOOOOOOO O $ O @@ -113,7 +118,7 @@ fun main(args: Array) { O OOOOOOOOO O OO OOOOOO IO - """) + """.trimIndent()) printMaze(""" OOOOOOOOOOOOOOOOO O O @@ -124,7 +129,7 @@ fun main(args: Array) { O O I O O O OOOOOOOOOOOOOOOOO - """) + """.trimIndent()) } // UTILITIES @@ -138,11 +143,11 @@ fun printMaze(str: String) { for (j in 0..maze.width - 1) { val cell = Pair(i, j) print( - if (maze.walls[i][j]) "O" - else if (cell == maze.start) "I" - else if (cell == maze.end) "$" - else if (path != null && path.contains(cell)) "~" - else " " + if (maze.walls[i][j]) "O" + else if (cell == maze.start) "I" + else if (cell == maze.end) "$" + else if (path != null && path.contains(cell)) "~" + else " " ) } println("") @@ -171,12 +176,12 @@ fun printMaze(str: String) { */ fun makeMaze(s: String): Maze { val lines = s.split("\n")!! - val w = max(lines.toList(), comparator { o1, o2 -> - val l1: Int = o1?.size ?: 0 - val l2 = o2?.size ?: 0 + val w = lines.maxWithOrNull(Comparator { o1, o2 -> + val l1: Int = o1?.length ?: 0 + val l2 = o2?.length ?: 0 l1 - l2 })!! - val data = Array>(lines.size) { Array(w.size) { false } } + val data = Array>(lines.size) { Array(w.length) { false } } var start: Pair? = null var end: Pair? = null @@ -202,24 +207,9 @@ fun makeMaze(s: String): Maze { throw IllegalArgumentException("No goal point in the maze (should be indicated with a '$' sign)") } - return Maze(w.size, lines.size, data, start!!, end!!) + return Maze(w.length, lines.size, data, start!!, end!!) } // An excerpt from the Standard Library -val String?.indices: IntRange get() = IntRange(0, this!!.size) - -fun Map.set(k: K, v: V) { - put(k, v) -} - -fun comparator (f: (T, T) -> Int): Comparator = object : Comparator { - override fun compare(o1: T, o2: T): Int = f(o1, o2) - override fun equals(p: Any?): Boolean = false -} - -fun > Array.to(result: C): C { - for (elem in this) - result.add(elem) - return result -} +val String?.indices: IntRange get() = IntRange(0, this!!.length) diff --git a/js/js.translator/testData/webDemoExamples2/maze.out b/js/js.translator/testData/webDemoExamples/maze.out similarity index 56% rename from js/js.translator/testData/webDemoExamples2/maze.out rename to js/js.translator/testData/webDemoExamples/maze.out index 537f1c5c465..5423ff45504 100644 --- a/js/js.translator/testData/webDemoExamples2/maze.out +++ b/js/js.translator/testData/webDemoExamples/maze.out @@ -7,39 +7,34 @@ I O $ Result: No path Maze: - -O $ -O ~ -O ~ -O ~ -O ~~~~~~~~~I - +O $ +O ~ +O ~ +O ~ +O ~~~~~~~~~I Result: Path found Maze: - OOOOOOOOOOO -O $~~~~~ O +O $~~~~~ O OOOOOOO~OOO -O ~~~ O +O ~~~ O OOOOO~OOOOO -O~~~~~ O +O~~~~~ O O~OOOOOOOOO -O~~~~~~ OO +O~~~~~~ OO OOOOOO~~~IO - Result: Path found Maze: - OOOOOOOOOOOOOOOOO -O ~~~ O -O$~~O~ O -OOOOO~ O -O ~~~~ O +O ~~~ O +O$~~O~ O +OOOOO~ O +O ~~~~ O O ~OOOOOOOOOOOOOO -O ~ O I O +O ~ O I O O ~~~~~~~~~~~~~ O OOOOOOOOOOOOOOOOO - Result: Path found + diff --git a/js/js.translator/testData/webDemoExamples1/multiLanguageHello.kt b/js/js.translator/testData/webDemoExamples/multiLanguageHello.kt similarity index 93% rename from js/js.translator/testData/webDemoExamples1/multiLanguageHello.kt rename to js/js.translator/testData/webDemoExamples/multiLanguageHello.kt index 2ffd12f0f17..3b38b33f72a 100644 --- a/js/js.translator/testData/webDemoExamples1/multiLanguageHello.kt +++ b/js/js.translator/testData/webDemoExamples/multiLanguageHello.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [FR] + fun main(args: Array) { val language = if (args.size == 0) "EN" else args[0] println(when (language) { diff --git a/js/js.translator/testData/webDemoExamples/multiLanguageHello.out b/js/js.translator/testData/webDemoExamples/multiLanguageHello.out new file mode 100644 index 00000000000..f43e12843aa --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/multiLanguageHello.out @@ -0,0 +1 @@ +Salut! diff --git a/js/js.translator/testData/webDemoExamples1/nullChecks.kt b/js/js.translator/testData/webDemoExamples/nullChecks1.kt similarity index 96% rename from js/js.translator/testData/webDemoExamples1/nullChecks.kt rename to js/js.translator/testData/webDemoExamples/nullChecks1.kt index 658d3d93fa2..c18d355c3bf 100644 --- a/js/js.translator/testData/webDemoExamples1/nullChecks.kt +++ b/js/js.translator/testData/webDemoExamples/nullChecks1.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [] + // Return null if str does not hold a number fun myParseInt(str: String): Int? = str.toIntOrNull().also { if (it == null) println("One of arguments isn't Int") diff --git a/js/js.translator/testData/webDemoExamples/nullChecks1.out b/js/js.translator/testData/webDemoExamples/nullChecks1.out new file mode 100644 index 00000000000..36512d4d09d --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/nullChecks1.out @@ -0,0 +1 @@ +No number supplied \ No newline at end of file diff --git a/js/js.translator/testData/webDemoExamples/nullChecks2.kt b/js/js.translator/testData/webDemoExamples/nullChecks2.kt new file mode 100644 index 00000000000..de592f60e4c --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/nullChecks2.kt @@ -0,0 +1,21 @@ +// MAIN_ARGS: [2,3] + +// Return null if str does not hold a number +fun myParseInt(str: String): Int? = str.toIntOrNull().also { + if (it == null) println("One of arguments isn't Int") +} + +fun main(args: Array) { + if (args.size < 2) { + print("No number supplied"); + } + else { + val x = myParseInt(args[0]) + val y = myParseInt(args[1]) + + // We cannot say 'x * y' now because they may hold nulls + if (x != null && y != null) { + print(x * y) // Now we can + } + } +} diff --git a/js/js.translator/testData/webDemoExamples/nullChecks2.out b/js/js.translator/testData/webDemoExamples/nullChecks2.out new file mode 100644 index 00000000000..62f9457511f --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/nullChecks2.out @@ -0,0 +1 @@ +6 \ No newline at end of file diff --git a/js/js.translator/testData/webDemoExamples1/objectOrientedHello.kt b/js/js.translator/testData/webDemoExamples/objectOrientedHello.kt similarity index 88% rename from js/js.translator/testData/webDemoExamples1/objectOrientedHello.kt rename to js/js.translator/testData/webDemoExamples/objectOrientedHello.kt index dcce9224b02..c20b47efb78 100644 --- a/js/js.translator/testData/webDemoExamples1/objectOrientedHello.kt +++ b/js/js.translator/testData/webDemoExamples/objectOrientedHello.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [Pavel] + class Greeter(name: String) { val name = name fun greet() { diff --git a/js/js.translator/testData/webDemoExamples/objectOrientedHello.out b/js/js.translator/testData/webDemoExamples/objectOrientedHello.out new file mode 100644 index 00000000000..cdde667199d --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/objectOrientedHello.out @@ -0,0 +1 @@ +Hello, Pavel! diff --git a/js/js.translator/testData/webDemoExamples1/patternMatching.kt b/js/js.translator/testData/webDemoExamples/patternMatching.kt similarity index 94% rename from js/js.translator/testData/webDemoExamples1/patternMatching.kt rename to js/js.translator/testData/webDemoExamples/patternMatching.kt index 0df24447ed0..3dfa6587e68 100644 --- a/js/js.translator/testData/webDemoExamples1/patternMatching.kt +++ b/js/js.translator/testData/webDemoExamples/patternMatching.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [] + fun main(args: Array) { cases("Hello") cases(1) diff --git a/js/js.translator/testData/webDemoExamples/patternMatching.out b/js/js.translator/testData/webDemoExamples/patternMatching.out new file mode 100644 index 00000000000..5faa9711518 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/patternMatching.out @@ -0,0 +1,4 @@ +Greeting +One +Not a string +Unknown diff --git a/js/js.translator/testData/webDemoExamples1/printArg.kt b/js/js.translator/testData/webDemoExamples/printArg.kt similarity index 64% rename from js/js.translator/testData/webDemoExamples1/printArg.kt rename to js/js.translator/testData/webDemoExamples/printArg.kt index ad95f21687a..4a179908de1 100644 --- a/js/js.translator/testData/webDemoExamples1/printArg.kt +++ b/js/js.translator/testData/webDemoExamples/printArg.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [Hello_world!] + fun main(args: Array) { print(args[0]); } diff --git a/js/js.translator/testData/webDemoExamples/printArg.out b/js/js.translator/testData/webDemoExamples/printArg.out new file mode 100644 index 00000000000..677babdfc22 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/printArg.out @@ -0,0 +1 @@ +Hello_world! \ No newline at end of file diff --git a/js/js.translator/testData/webDemoExamples1/ranges.kt b/js/js.translator/testData/webDemoExamples/ranges1.kt similarity index 97% rename from js/js.translator/testData/webDemoExamples1/ranges.kt rename to js/js.translator/testData/webDemoExamples/ranges1.kt index cc5bfefed08..2357b7748cd 100644 --- a/js/js.translator/testData/webDemoExamples1/ranges.kt +++ b/js/js.translator/testData/webDemoExamples/ranges1.kt @@ -1,3 +1,4 @@ +// MAIN_ARGS: [4] fun main(args: Array) { val x = args[0].toInt() diff --git a/js/js.translator/testData/webDemoExamples/ranges1.out b/js/js.translator/testData/webDemoExamples/ranges1.out new file mode 100644 index 00000000000..18b18cc5b21 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/ranges1.out @@ -0,0 +1,5 @@ +OK + 1 2 3 4 5 +Out: array has only 3 elements. x = 4 +Yes: array contains aaa +No: array doesn't contains ddd diff --git a/js/js.translator/testData/webDemoExamples/ranges2.kt b/js/js.translator/testData/webDemoExamples/ranges2.kt new file mode 100644 index 00000000000..d846d8e7f4d --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/ranges2.kt @@ -0,0 +1,35 @@ +// MAIN_ARGS: [10] + +fun main(args: Array) { + val x = args[0].toInt() + //Check if a number lies within a range: + val y = 10 + if (x in 1..y - 1) + println("OK") + + //Iterate over a range: + for (a in 1..5) + print(" ${a}") + + //Check if a number is out of range: + println() + val array = mutableListOf() + + array.add("aaa") + array.add("bbb") + array.add("ccc") + + if (x !in 0..array.size) + println("Out: array has only ${array.size} elements. x = ${x}") + + //Check if a collection contains an object: + if ("aaa" in array) // collection.contains(obj) is called + println("Yes: array contains aaa") + + if ("ddd" in array) // collection.contains(obj) is called + println("Yes: array contains ddd") + else + println("No: array doesn't contains ddd") +} + + diff --git a/js/js.translator/testData/webDemoExamples/ranges2.out b/js/js.translator/testData/webDemoExamples/ranges2.out new file mode 100644 index 00000000000..b40dcc25094 --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/ranges2.out @@ -0,0 +1,4 @@ + 1 2 3 4 5 +Out: array has only 3 elements. x = 10 +Yes: array contains aaa +No: array doesn't contains ddd diff --git a/js/js.translator/testData/webDemoExamples1/whileLoop.kt b/js/js.translator/testData/webDemoExamples/whileLoop.kt similarity index 69% rename from js/js.translator/testData/webDemoExamples1/whileLoop.kt rename to js/js.translator/testData/webDemoExamples/whileLoop.kt index 3ce84a02a0a..17abf5898ef 100644 --- a/js/js.translator/testData/webDemoExamples1/whileLoop.kt +++ b/js/js.translator/testData/webDemoExamples/whileLoop.kt @@ -1,3 +1,5 @@ +// MAIN_ARGS: [guest1,guest2,guest3,guest4] + fun main(args: Array) { var i = 0 while (i < args.size) diff --git a/js/js.translator/testData/webDemoExamples/whileLoop.out b/js/js.translator/testData/webDemoExamples/whileLoop.out new file mode 100644 index 00000000000..a20d798e0fd --- /dev/null +++ b/js/js.translator/testData/webDemoExamples/whileLoop.out @@ -0,0 +1,4 @@ +guest1 +guest2 +guest3 +guest4 diff --git a/js/js.translator/testData/webDemoExamples2/bottles.out b/js/js.translator/testData/webDemoExamples2/bottles.out deleted file mode 100644 index 507e7e5830e..00000000000 --- a/js/js.translator/testData/webDemoExamples2/bottles.out +++ /dev/null @@ -1,301 +0,0 @@ -The "99 bottles of beer" song - -99 bottles of beer on the wall, 99 bottles of beer. -Take one down, pass it around, 98 bottles of beer on the wall. - -98 bottles of beer on the wall, 98 bottles of beer. -Take one down, pass it around, 97 bottles of beer on the wall. - -97 bottles of beer on the wall, 97 bottles of beer. -Take one down, pass it around, 96 bottles of beer on the wall. - -96 bottles of beer on the wall, 96 bottles of beer. -Take one down, pass it around, 95 bottles of beer on the wall. - -95 bottles of beer on the wall, 95 bottles of beer. -Take one down, pass it around, 94 bottles of beer on the wall. - -94 bottles of beer on the wall, 94 bottles of beer. -Take one down, pass it around, 93 bottles of beer on the wall. - -93 bottles of beer on the wall, 93 bottles of beer. -Take one down, pass it around, 92 bottles of beer on the wall. - -92 bottles of beer on the wall, 92 bottles of beer. -Take one down, pass it around, 91 bottles of beer on the wall. - -91 bottles of beer on the wall, 91 bottles of beer. -Take one down, pass it around, 90 bottles of beer on the wall. - -90 bottles of beer on the wall, 90 bottles of beer. -Take one down, pass it around, 89 bottles of beer on the wall. - -89 bottles of beer on the wall, 89 bottles of beer. -Take one down, pass it around, 88 bottles of beer on the wall. - -88 bottles of beer on the wall, 88 bottles of beer. -Take one down, pass it around, 87 bottles of beer on the wall. - -87 bottles of beer on the wall, 87 bottles of beer. -Take one down, pass it around, 86 bottles of beer on the wall. - -86 bottles of beer on the wall, 86 bottles of beer. -Take one down, pass it around, 85 bottles of beer on the wall. - -85 bottles of beer on the wall, 85 bottles of beer. -Take one down, pass it around, 84 bottles of beer on the wall. - -84 bottles of beer on the wall, 84 bottles of beer. -Take one down, pass it around, 83 bottles of beer on the wall. - -83 bottles of beer on the wall, 83 bottles of beer. -Take one down, pass it around, 82 bottles of beer on the wall. - -82 bottles of beer on the wall, 82 bottles of beer. -Take one down, pass it around, 81 bottles of beer on the wall. - -81 bottles of beer on the wall, 81 bottles of beer. -Take one down, pass it around, 80 bottles of beer on the wall. - -80 bottles of beer on the wall, 80 bottles of beer. -Take one down, pass it around, 79 bottles of beer on the wall. - -79 bottles of beer on the wall, 79 bottles of beer. -Take one down, pass it around, 78 bottles of beer on the wall. - -78 bottles of beer on the wall, 78 bottles of beer. -Take one down, pass it around, 77 bottles of beer on the wall. - -77 bottles of beer on the wall, 77 bottles of beer. -Take one down, pass it around, 76 bottles of beer on the wall. - -76 bottles of beer on the wall, 76 bottles of beer. -Take one down, pass it around, 75 bottles of beer on the wall. - -75 bottles of beer on the wall, 75 bottles of beer. -Take one down, pass it around, 74 bottles of beer on the wall. - -74 bottles of beer on the wall, 74 bottles of beer. -Take one down, pass it around, 73 bottles of beer on the wall. - -73 bottles of beer on the wall, 73 bottles of beer. -Take one down, pass it around, 72 bottles of beer on the wall. - -72 bottles of beer on the wall, 72 bottles of beer. -Take one down, pass it around, 71 bottles of beer on the wall. - -71 bottles of beer on the wall, 71 bottles of beer. -Take one down, pass it around, 70 bottles of beer on the wall. - -70 bottles of beer on the wall, 70 bottles of beer. -Take one down, pass it around, 69 bottles of beer on the wall. - -69 bottles of beer on the wall, 69 bottles of beer. -Take one down, pass it around, 68 bottles of beer on the wall. - -68 bottles of beer on the wall, 68 bottles of beer. -Take one down, pass it around, 67 bottles of beer on the wall. - -67 bottles of beer on the wall, 67 bottles of beer. -Take one down, pass it around, 66 bottles of beer on the wall. - -66 bottles of beer on the wall, 66 bottles of beer. -Take one down, pass it around, 65 bottles of beer on the wall. - -65 bottles of beer on the wall, 65 bottles of beer. -Take one down, pass it around, 64 bottles of beer on the wall. - -64 bottles of beer on the wall, 64 bottles of beer. -Take one down, pass it around, 63 bottles of beer on the wall. - -63 bottles of beer on the wall, 63 bottles of beer. -Take one down, pass it around, 62 bottles of beer on the wall. - -62 bottles of beer on the wall, 62 bottles of beer. -Take one down, pass it around, 61 bottles of beer on the wall. - -61 bottles of beer on the wall, 61 bottles of beer. -Take one down, pass it around, 60 bottles of beer on the wall. - -60 bottles of beer on the wall, 60 bottles of beer. -Take one down, pass it around, 59 bottles of beer on the wall. - -59 bottles of beer on the wall, 59 bottles of beer. -Take one down, pass it around, 58 bottles of beer on the wall. - -58 bottles of beer on the wall, 58 bottles of beer. -Take one down, pass it around, 57 bottles of beer on the wall. - -57 bottles of beer on the wall, 57 bottles of beer. -Take one down, pass it around, 56 bottles of beer on the wall. - -56 bottles of beer on the wall, 56 bottles of beer. -Take one down, pass it around, 55 bottles of beer on the wall. - -55 bottles of beer on the wall, 55 bottles of beer. -Take one down, pass it around, 54 bottles of beer on the wall. - -54 bottles of beer on the wall, 54 bottles of beer. -Take one down, pass it around, 53 bottles of beer on the wall. - -53 bottles of beer on the wall, 53 bottles of beer. -Take one down, pass it around, 52 bottles of beer on the wall. - -52 bottles of beer on the wall, 52 bottles of beer. -Take one down, pass it around, 51 bottles of beer on the wall. - -51 bottles of beer on the wall, 51 bottles of beer. -Take one down, pass it around, 50 bottles of beer on the wall. - -50 bottles of beer on the wall, 50 bottles of beer. -Take one down, pass it around, 49 bottles of beer on the wall. - -49 bottles of beer on the wall, 49 bottles of beer. -Take one down, pass it around, 48 bottles of beer on the wall. - -48 bottles of beer on the wall, 48 bottles of beer. -Take one down, pass it around, 47 bottles of beer on the wall. - -47 bottles of beer on the wall, 47 bottles of beer. -Take one down, pass it around, 46 bottles of beer on the wall. - -46 bottles of beer on the wall, 46 bottles of beer. -Take one down, pass it around, 45 bottles of beer on the wall. - -45 bottles of beer on the wall, 45 bottles of beer. -Take one down, pass it around, 44 bottles of beer on the wall. - -44 bottles of beer on the wall, 44 bottles of beer. -Take one down, pass it around, 43 bottles of beer on the wall. - -43 bottles of beer on the wall, 43 bottles of beer. -Take one down, pass it around, 42 bottles of beer on the wall. - -42 bottles of beer on the wall, 42 bottles of beer. -Take one down, pass it around, 41 bottles of beer on the wall. - -41 bottles of beer on the wall, 41 bottles of beer. -Take one down, pass it around, 40 bottles of beer on the wall. - -40 bottles of beer on the wall, 40 bottles of beer. -Take one down, pass it around, 39 bottles of beer on the wall. - -39 bottles of beer on the wall, 39 bottles of beer. -Take one down, pass it around, 38 bottles of beer on the wall. - -38 bottles of beer on the wall, 38 bottles of beer. -Take one down, pass it around, 37 bottles of beer on the wall. - -37 bottles of beer on the wall, 37 bottles of beer. -Take one down, pass it around, 36 bottles of beer on the wall. - -36 bottles of beer on the wall, 36 bottles of beer. -Take one down, pass it around, 35 bottles of beer on the wall. - -35 bottles of beer on the wall, 35 bottles of beer. -Take one down, pass it around, 34 bottles of beer on the wall. - -34 bottles of beer on the wall, 34 bottles of beer. -Take one down, pass it around, 33 bottles of beer on the wall. - -33 bottles of beer on the wall, 33 bottles of beer. -Take one down, pass it around, 32 bottles of beer on the wall. - -32 bottles of beer on the wall, 32 bottles of beer. -Take one down, pass it around, 31 bottles of beer on the wall. - -31 bottles of beer on the wall, 31 bottles of beer. -Take one down, pass it around, 30 bottles of beer on the wall. - -30 bottles of beer on the wall, 30 bottles of beer. -Take one down, pass it around, 29 bottles of beer on the wall. - -29 bottles of beer on the wall, 29 bottles of beer. -Take one down, pass it around, 28 bottles of beer on the wall. - -28 bottles of beer on the wall, 28 bottles of beer. -Take one down, pass it around, 27 bottles of beer on the wall. - -27 bottles of beer on the wall, 27 bottles of beer. -Take one down, pass it around, 26 bottles of beer on the wall. - -26 bottles of beer on the wall, 26 bottles of beer. -Take one down, pass it around, 25 bottles of beer on the wall. - -25 bottles of beer on the wall, 25 bottles of beer. -Take one down, pass it around, 24 bottles of beer on the wall. - -24 bottles of beer on the wall, 24 bottles of beer. -Take one down, pass it around, 23 bottles of beer on the wall. - -23 bottles of beer on the wall, 23 bottles of beer. -Take one down, pass it around, 22 bottles of beer on the wall. - -22 bottles of beer on the wall, 22 bottles of beer. -Take one down, pass it around, 21 bottles of beer on the wall. - -21 bottles of beer on the wall, 21 bottles of beer. -Take one down, pass it around, 20 bottles of beer on the wall. - -20 bottles of beer on the wall, 20 bottles of beer. -Take one down, pass it around, 19 bottles of beer on the wall. - -19 bottles of beer on the wall, 19 bottles of beer. -Take one down, pass it around, 18 bottles of beer on the wall. - -18 bottles of beer on the wall, 18 bottles of beer. -Take one down, pass it around, 17 bottles of beer on the wall. - -17 bottles of beer on the wall, 17 bottles of beer. -Take one down, pass it around, 16 bottles of beer on the wall. - -16 bottles of beer on the wall, 16 bottles of beer. -Take one down, pass it around, 15 bottles of beer on the wall. - -15 bottles of beer on the wall, 15 bottles of beer. -Take one down, pass it around, 14 bottles of beer on the wall. - -14 bottles of beer on the wall, 14 bottles of beer. -Take one down, pass it around, 13 bottles of beer on the wall. - -13 bottles of beer on the wall, 13 bottles of beer. -Take one down, pass it around, 12 bottles of beer on the wall. - -12 bottles of beer on the wall, 12 bottles of beer. -Take one down, pass it around, 11 bottles of beer on the wall. - -11 bottles of beer on the wall, 11 bottles of beer. -Take one down, pass it around, 10 bottles of beer on the wall. - -10 bottles of beer on the wall, 10 bottles of beer. -Take one down, pass it around, 9 bottles of beer on the wall. - -9 bottles of beer on the wall, 9 bottles of beer. -Take one down, pass it around, 8 bottles of beer on the wall. - -8 bottles of beer on the wall, 8 bottles of beer. -Take one down, pass it around, 7 bottles of beer on the wall. - -7 bottles of beer on the wall, 7 bottles of beer. -Take one down, pass it around, 6 bottles of beer on the wall. - -6 bottles of beer on the wall, 6 bottles of beer. -Take one down, pass it around, 5 bottles of beer on the wall. - -5 bottles of beer on the wall, 5 bottles of beer. -Take one down, pass it around, 4 bottles of beer on the wall. - -4 bottles of beer on the wall, 4 bottles of beer. -Take one down, pass it around, 3 bottles of beer on the wall. - -3 bottles of beer on the wall, 3 bottles of beer. -Take one down, pass it around, 2 bottles of beer on the wall. - -2 bottles of beer on the wall, 2 bottles of beer. -Take one down, pass it around, 1 bottle of beer on the wall. - -1 bottle of beer on the wall, 1 bottle of beer. -Take one down, pass it around, no more bottles of beer on the wall. - -No more bottles of beer on the wall, no more bottles of beer. -Go to the store and buy some more, 99 bottles of beer on the wall. diff --git a/js/js.translator/testData/webDemoExamples2/builder.out b/js/js.translator/testData/webDemoExamples2/builder.out deleted file mode 100644 index 470958d9152..00000000000 --- a/js/js.translator/testData/webDemoExamples2/builder.out +++ /dev/null @@ -1,38 +0,0 @@ - - - - XML encoding with Kotlin - - - -

- XML encoding with Kotlin -

-

- this format can be used as an alternative markup to XML -

- - Kotlin - -

- This is some - - mixed - - text. For more see the - - Kotlin - - project -

-

- some text -

-

- Command line arguments were: -

    -
-

- - -