JS: move more test to box tests
This commit is contained in:
@@ -1149,14 +1149,6 @@ fun main(args: Array<String>) {
|
||||
model("multiModule/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractLabelTest>() {
|
||||
model("labels/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractJsCodeTest>() {
|
||||
model("jsCode/cases")
|
||||
}
|
||||
|
||||
testClass<AbstractReifiedTest>() {
|
||||
model("reified/cases")
|
||||
}
|
||||
|
||||
-30
@@ -1,30 +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;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class AbstractSingleFileTranslationWithDirectivesTest extends SingleFileTranslationTest {
|
||||
public AbstractSingleFileTranslationWithDirectivesTest(@NotNull String main) {
|
||||
super(main);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.psi.KtNamedFunction
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils.TestFileFactory
|
||||
import java.io.File
|
||||
|
||||
abstract class KotlinJSMultiFileTest(path: String) : SingleFileTranslationTest(path) {
|
||||
var tempDir: File? = null
|
||||
|
||||
override fun doTest(filename: String) {
|
||||
tempDir = FileUtil.createTempDirectory("test", "src")
|
||||
tempDir!!.deleteOnExit()
|
||||
try {
|
||||
val file = File(filename)
|
||||
val expectedText = KotlinTestUtils.doLoadFile(file)
|
||||
var testPackage: String? = null
|
||||
|
||||
val inputFiles = KotlinTestUtils.createTestFiles(file.name, expectedText, object : TestFileFactory<String, String> {
|
||||
override fun createFile(module: String?, fileName: String, text: String, directives: Map<String, String>): String? {
|
||||
val output = File(tempDir!!, fileName)
|
||||
KotlinTestUtils.mkdirs(file.parentFile)
|
||||
output.writeText(text, Charsets.UTF_8)
|
||||
|
||||
val ktFile = KtPsiFactory(project).createFile(text)
|
||||
val boxFunction = ktFile.declarations.find { it is KtNamedFunction && it.name == TEST_FUNCTION }
|
||||
if (boxFunction != null) {
|
||||
testPackage = getPackageName(ktFile)
|
||||
}
|
||||
|
||||
return output.path
|
||||
}
|
||||
|
||||
override fun createModule(name: String, dependencies: List<String>): String? = error("Multi-module tests not supported")
|
||||
})
|
||||
runFunctionOutputTestByPaths(BasicTest.DEFAULT_ECMA_VERSIONS, inputFiles, testPackage!!, BasicTest.TEST_FUNCTION, "OK")
|
||||
}
|
||||
finally {
|
||||
tempDir!!.deleteRecursively()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4315,4 +4315,361 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/jsCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class JsCode extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInJsCode() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/jsCode"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("break.kt")
|
||||
public void testBreak() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/break.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("catchScope.kt")
|
||||
public void testCatchScope() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/catchScope.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("codeFromVariable.kt")
|
||||
public void testCodeFromVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/codeFromVariable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("continue.kt")
|
||||
public void testContinue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/continue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("doWhile.kt")
|
||||
public void testDoWhile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/doWhile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("for.kt")
|
||||
public void testFor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/for.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIn.kt")
|
||||
public void testForIn() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/forIn.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/function.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("if.kt")
|
||||
public void testIf() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/if.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("invocation.kt")
|
||||
public void testInvocation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/invocation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("label.kt")
|
||||
public void testLabel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/label.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelNestedClash.kt")
|
||||
public void testLabelNestedClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/labelNestedClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelNestedClashWithKotlin.kt")
|
||||
public void testLabelNestedClashWithKotlin() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/labelNestedClashWithKotlin.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelSiblingClash.kt")
|
||||
public void testLabelSiblingClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/labelSiblingClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("literal.kt")
|
||||
public void testLiteral() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/literal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("object.kt")
|
||||
public void testObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/object.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectScopes.kt")
|
||||
public void testObjectScopes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/objectScopes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("operators.kt")
|
||||
public void testOperators() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/operators.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("quotes.kt")
|
||||
public void testQuotes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/quotes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("switch.kt")
|
||||
public void testSwitch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/switch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatchFinally.kt")
|
||||
public void testTryCatchFinally() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/tryCatchFinally.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("while.kt")
|
||||
public void testWhile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/jsCode/while.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/labels")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Labels extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInLabels() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/labels"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("labelOnExpression.kt")
|
||||
public void testLabelOnExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/labelOnExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelWithVariableClashing.kt")
|
||||
public void testLabelWithVariableClashing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/labelWithVariableClashing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedInlineLabels.kt")
|
||||
public void testNestedInlineLabels() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/nestedInlineLabels.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLabels.kt")
|
||||
public void testNestedLabels() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/nestedLabels.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLabelsInlinedClashing.kt")
|
||||
public void testNestedLabelsInlinedClashing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/nestedLabelsInlinedClashing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLabelsInlinedClashingAtFunctionsWithClosure.kt")
|
||||
public void testNestedLabelsInlinedClashingAtFunctionsWithClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/nestedLabelsInlinedClashingAtFunctionsWithClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("siblingLabels.kt")
|
||||
public void testSiblingLabels() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/siblingLabels.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("siblingLabelsInlined.kt")
|
||||
public void testSiblingLabelsInlined() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/siblingLabelsInlined.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("siblingLabelsInlinedClashing.kt")
|
||||
public void testSiblingLabelsInlinedClashing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleLabel.kt")
|
||||
public void testSimpleLabel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/simpleLabel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleLabelInlined.kt")
|
||||
public void testSimpleLabelInlined() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/labels/simpleLabelInlined.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/operatorOverloading")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class OperatorOverloading extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInOperatorOverloading() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/operatorOverloading"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("binaryDivOverload.kt")
|
||||
public void testBinaryDivOverload() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/binaryDivOverload.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compareTo.kt")
|
||||
public void testCompareTo() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/compareTo.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compareToByName.kt")
|
||||
public void testCompareToByName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/compareToByName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaRhs.kt")
|
||||
public void testLambdaRhs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/lambdaRhs.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("notOverload.kt")
|
||||
public void testNotOverload() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/notOverload.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce.kt")
|
||||
public void testOperatorOverloadOnPropertyCallGetterAndSetterOnlyOnce() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPlusAssignArrayList.kt")
|
||||
public void testOverloadPlusAssignArrayList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/overloadPlusAssignArrayList.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPlusAssignViaExtensionFunction.kt")
|
||||
public void testOverloadPlusAssignViaExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/overloadPlusAssignViaExtensionFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPlusAssignViaPlusExtensionFunction.kt")
|
||||
public void testOverloadPlusAssignViaPlusExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/overloadPlusAssignViaPlusExtensionFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPlusViaExtensionFunction.kt")
|
||||
public void testOverloadPlusViaExtensionFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/overloadPlusViaExtensionFunction.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadUnaryOperationsViaExtensionFunctions.kt")
|
||||
public void testOverloadUnaryOperationsViaExtensionFunctions() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/overloadUnaryOperationsViaExtensionFunctions.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadedCallOnProperty.kt")
|
||||
public void testOverloadedCallOnProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/overloadedCallOnProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("plusAndMinusAsAnExpression.kt")
|
||||
public void testPlusAndMinusAsAnExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/plusAndMinusAsAnExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("plusAssignNoReassign.kt")
|
||||
public void testPlusAssignNoReassign() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/plusAssignNoReassign.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("plusOverload.kt")
|
||||
public void testPlusOverload() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/plusOverload.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("postfixInc.kt")
|
||||
public void testPostfixInc() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/postfixInc.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("postfixOnProperty.kt")
|
||||
public void testPostfixOnProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/postfixOnProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("prefixDecOverload.kt")
|
||||
public void testPrefixDecOverload() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/prefixDecOverload.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("prefixIncReturnsCorrectValue.kt")
|
||||
public void testPrefixIncReturnsCorrectValue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/prefixIncReturnsCorrectValue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unaryOnIntProperty.kt")
|
||||
public void testUnaryOnIntProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/unaryOnIntProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("unaryOnIntPropertyAsStatement.kt")
|
||||
public void testUnaryOnIntPropertyAsStatement() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/unaryOnIntPropertyAsStatement.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("usingModInCaseModAssignNotAvailable.kt")
|
||||
public void testUsingModInCaseModAssignNotAvailable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/operatorOverloading/usingModInCaseModAssignNotAvailable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,150 +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;
|
||||
|
||||
import com.google.dart.compiler.backend.js.ast.JsProgram;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.js.test.MultipleFilesTranslationTest;
|
||||
import org.jetbrains.kotlin.js.test.utils.DirectiveTestUtils;
|
||||
import org.jetbrains.kotlin.js.test.utils.JsTestUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.js.test.utils.JsTestUtils.getAllFilesInDir;
|
||||
|
||||
public final class InlineMultiFileTest extends MultipleFilesTranslationTest {
|
||||
public InlineMultiFileTest() {
|
||||
super("inlineMultiFile/");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
public void testInlineMultiFileSimple() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testBuilders() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testBuildersAndLambdaCapturing() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testAnonymousObjectOnCallSite() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testAnonymousObjectOnCallSiteSuperParams() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testAnonymousObjectOnDeclarationSite() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testAnonymousObjectOnDeclarationSiteSuperParams() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTrait() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testUse() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testWith() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTryCatch() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTryCatch2() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testTryCatchFinally() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testLambdaCloning() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testLambdaInLambda2() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testLambdaInLambdaNoInline() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testRegeneratedLambdaName() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSameCaptured() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testClosureChain() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testInlineInDefaultParameter() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testDefaultMethod() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleDefaultMethod() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testCaptureInlinable() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testCaptureInlinableAndOther() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testCaptureThisAndReceiver() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testGenerics() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleCapturingInClass() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleCapturingInPackage() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/jsCode/cases")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class JsCodeTestGenerated extends AbstractJsCodeTest {
|
||||
public void testAllFilesPresentInCases() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/jsCode/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("break.kt")
|
||||
public void testBreak() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/break.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("catchScope.kt")
|
||||
public void testCatchScope() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/catchScope.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("codeFromVariable.kt")
|
||||
public void testCodeFromVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/codeFromVariable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("continue.kt")
|
||||
public void testContinue() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/continue.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("doWhile.kt")
|
||||
public void testDoWhile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/doWhile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("for.kt")
|
||||
public void testFor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/for.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("forIn.kt")
|
||||
public void testForIn() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/forIn.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/function.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("if.kt")
|
||||
public void testIf() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/if.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("invocation.kt")
|
||||
public void testInvocation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/invocation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("label.kt")
|
||||
public void testLabel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/label.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelNestedClash.kt")
|
||||
public void testLabelNestedClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/labelNestedClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelNestedClashWithKotlin.kt")
|
||||
public void testLabelNestedClashWithKotlin() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/labelNestedClashWithKotlin.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelSiblingClash.kt")
|
||||
public void testLabelSiblingClash() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/labelSiblingClash.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("literal.kt")
|
||||
public void testLiteral() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/literal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("object.kt")
|
||||
public void testObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/object.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectScopes.kt")
|
||||
public void testObjectScopes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/objectScopes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("operators.kt")
|
||||
public void testOperators() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/operators.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("quotes.kt")
|
||||
public void testQuotes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/quotes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("switch.kt")
|
||||
public void testSwitch() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/switch.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("tryCatchFinally.kt")
|
||||
public void testTryCatchFinally() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/tryCatchFinally.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("while.kt")
|
||||
public void testWhile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/jsCode/cases/while.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("js/js.translator/testData/labels/cases")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class LabelTestGenerated extends AbstractLabelTest {
|
||||
public void testAllFilesPresentInCases() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/labels/cases"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("labelOnExpression.kt")
|
||||
public void testLabelOnExpression() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/labelOnExpression.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("labelWithVariableClashing.kt")
|
||||
public void testLabelWithVariableClashing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/labelWithVariableClashing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedInlineLabels.kt")
|
||||
public void testNestedInlineLabels() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/nestedInlineLabels.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLabels.kt")
|
||||
public void testNestedLabels() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/nestedLabels.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLabelsInlinedClashing.kt")
|
||||
public void testNestedLabelsInlinedClashing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/nestedLabelsInlinedClashing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedLabelsInlinedClashingAtFunctionsWithClosure.kt")
|
||||
public void testNestedLabelsInlinedClashingAtFunctionsWithClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/nestedLabelsInlinedClashingAtFunctionsWithClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("siblingLabels.kt")
|
||||
public void testSiblingLabels() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/siblingLabels.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("siblingLabelsInlined.kt")
|
||||
public void testSiblingLabelsInlined() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/siblingLabelsInlined.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("siblingLabelsInlinedClashing.kt")
|
||||
public void testSiblingLabelsInlinedClashing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/siblingLabelsInlinedClashing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleLabel.kt")
|
||||
public void testSimpleLabel() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/simpleLabel.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleLabelInlined.kt")
|
||||
public void testSimpleLabelInlined() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/labels/cases/simpleLabelInlined.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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;
|
||||
|
||||
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
|
||||
public final class OperatorOverloadingTest extends SingleFileTranslationTest {
|
||||
|
||||
public OperatorOverloadingTest() {
|
||||
super("operatorOverloading/");
|
||||
}
|
||||
|
||||
public void testPlusOverload() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPostfixInc() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPrefixDecOverload() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPrefixIncReturnsCorrectValue() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testOverloadedCallOnProperty() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPostfixOnProperty() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testOperatorOverloadOnPropertyCallGetterAndSetterOnlyOnce() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testUnaryOnIntProperty() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testUnaryOnIntPropertyAsStatement() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testBinaryDivOverload() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPlusAssignNoReassign() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testNotOverload() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testCompareTo() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testCompareToByName() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPlusAndMinusAsAnExpression() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testUsingModInCaseModAssignNotAvailable() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testOverloadPlusAssignArrayList() throws Exception {
|
||||
checkFooBoxIsOk("overloadPlusAssignArrayList.kt");
|
||||
}
|
||||
|
||||
public void testOverloadPlusAssignViaExtensionFunction() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testOverloadPlusViaExtensionFunction() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testOverloadPlusAssignViaPlusExtensionFunction() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testOverloadUnaryOperationsViaExtensionFunctions() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testLambdaRhs() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
-4
@@ -47,10 +47,6 @@ abstract class AbstractCompanionObjectTest : JsBasicBoxTest("objectIntrinsics/")
|
||||
|
||||
abstract class AbstractFunctionExpressionTest : JsBasicBoxTest("functionExpression/")
|
||||
|
||||
abstract class AbstractJsCodeTest : JsBasicBoxTest("jsCode/")
|
||||
|
||||
abstract class AbstractLabelTest : JsBasicBoxTest("labels/")
|
||||
|
||||
abstract class AbstractMultiModuleTest : JsBasicBoxTest("multiModule/")
|
||||
|
||||
abstract class AbstractReservedWordTest : JsBasicBoxTest("reservedWords/")
|
||||
|
||||
Vendored
Vendored
Vendored
Vendored
Vendored
Vendored
Vendored
Vendored
Vendored
Vendored
@@ -0,0 +1,9 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
|
||||
operator fun div(other: A) = "OK"
|
||||
|
||||
}
|
||||
|
||||
fun box() = A() / A()
|
||||
@@ -0,0 +1,18 @@
|
||||
package foo
|
||||
|
||||
|
||||
class A(t: Int) {
|
||||
var i = t
|
||||
operator fun compareTo(other: A) = (this.i - other.i)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (A(3) <= A(2)) return "fail1"
|
||||
if (A(2) < A(2)) return "fail2"
|
||||
if (A(1) < A(0)) return "fail3"
|
||||
if (A(2) > A(2)) return "fail4"
|
||||
if (A(3) > A(4)) return "fail5"
|
||||
if (A(0) >= A(100)) return "fail6"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package foo
|
||||
|
||||
|
||||
class A(t: Int) {
|
||||
var i = t
|
||||
infix operator fun compareTo(other: A) = (this.i - other.i)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (A(3) compareTo A(2) <= 0) return "fail1"
|
||||
if (A(2) compareTo A(2) != 0) return "fail2"
|
||||
if (A(1) compareTo A(0) <= 0) return "fail3"
|
||||
if (A(3) compareTo A(4) >= 0) return "fail4"
|
||||
if (A(0) compareTo A(100) >= 0) return "fail5"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
|
||||
operator fun not() = "OK"
|
||||
|
||||
}
|
||||
|
||||
fun box() = !A()
|
||||
+5
-3
@@ -25,8 +25,10 @@ class A() {
|
||||
}
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
val t = A()
|
||||
val d = t.b++;
|
||||
return (t.sc == 1) && (t.gc == 1);
|
||||
val d = t.b++
|
||||
if (t.sc != 1) return "fail1"
|
||||
if (t.gc != 1) return "fail2"
|
||||
return "OK"
|
||||
}
|
||||
+6
-2
@@ -12,12 +12,16 @@ operator fun <T> A<T>.plusAssign(other: Collection<T>) {
|
||||
addAll(other)
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var v1 = arrayListOf("foo")
|
||||
val v2 = listOf("bar")
|
||||
|
||||
val a = A(v1)
|
||||
a += v2
|
||||
|
||||
return (v1.size == 2 && v1[0] == "foo" && v1[1] == "bar")
|
||||
if (v1.size != 2) return "fail1: ${v1.size}"
|
||||
if (v1[0] != "foo") return "fail2: ${v1[0]}"
|
||||
if (v1[1] != "bar") return "fail3: ${v1[1]}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+2
-2
@@ -9,8 +9,8 @@ operator fun <T> Foo<T>.plus(x: T): Foo<T> = Foo(x)
|
||||
operator fun <T> MutableFoo<T>.plus(x: T): MutableFoo<T> = MutableFoo(x)
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var f = MutableFoo(1)
|
||||
f += 2
|
||||
return (f is MutableFoo && f.value == 2)
|
||||
return if (f is MutableFoo && f.value == 2) "OK" else "fail"
|
||||
}
|
||||
+6
-2
@@ -9,12 +9,16 @@ operator fun <T> ArrayList<T>.plus(other: Collection<T>): List<T> {
|
||||
return c
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var v1 = ArrayList<String>()
|
||||
v1.add("foo")
|
||||
val v2 = ArrayList<String>()
|
||||
v2.add("bar")
|
||||
val v = v1 + v2
|
||||
|
||||
return (v.size == 2 && v[0] == "foo" && v[1] == "bar")
|
||||
if (v.size != 2) return "fail1: ${v.size}"
|
||||
if (v[0] != "foo") return "fail2: ${v[0]}"
|
||||
if (v[1] != "bar") return "fail3: ${v[1]}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
package foo
|
||||
|
||||
class A(val c: Int) {
|
||||
}
|
||||
|
||||
|
||||
operator fun A.inc() = A(5)
|
||||
operator fun A.dec() = A(10)
|
||||
|
||||
fun box(): String {
|
||||
var a = A(1)
|
||||
|
||||
if ((++a).c != 5) return "fail1"
|
||||
if ((a++).c != 5) return "fail2"
|
||||
if ((--a).c != 10) return "fail3"
|
||||
if ((a--).c != 10) return "fail4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+2
-2
@@ -14,8 +14,8 @@ class MyInt() {
|
||||
}
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
a++;
|
||||
a++;
|
||||
return (a.b == 2);
|
||||
return if (a.b == 2) "OK" else "fail"
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
|
||||
operator fun unaryPlus() = "O"
|
||||
operator fun unaryMinus() = "K"
|
||||
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var c = A()
|
||||
return +c + -c
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ class A() {
|
||||
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var c = A()
|
||||
c += A()
|
||||
c += A()
|
||||
return c.message == "!!"
|
||||
return if (c.message == "!!") return "OK" else "fail"
|
||||
}
|
||||
+2
-2
@@ -6,7 +6,7 @@ class myInt(a: Int) {
|
||||
operator fun plus(other: myInt): myInt = myInt(value + other.value)
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
|
||||
return (myInt(3) + myInt(5)).value == 8
|
||||
return if ((myInt(3) + myInt(5)).value == 8) "OK" else "fail"
|
||||
}
|
||||
+2
-2
@@ -11,8 +11,8 @@ class MyInt() {
|
||||
}
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var c = MyInt()
|
||||
c++;
|
||||
return (c.b == 1);
|
||||
return if (c.b == 1) "OK" else "fail"
|
||||
}
|
||||
+6
-2
@@ -12,7 +12,11 @@ class MyInt() {
|
||||
}
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
val d = a++;
|
||||
return (a.b == 1) && (d.b == 1);
|
||||
|
||||
if (a.b != 1) return "fail1: ${a.b}"
|
||||
if (d.b != 1) return "fail2: ${d.b}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+2
-2
@@ -11,8 +11,8 @@ class MyInt() {
|
||||
}
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var c = MyInt()
|
||||
--c;
|
||||
return (c.b == 1);
|
||||
return if (c.b == 1) "OK" else "fail: ${c.b}"
|
||||
}
|
||||
+2
-2
@@ -10,8 +10,8 @@ class MyInt() {
|
||||
}
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var c = MyInt()
|
||||
val d = --c;
|
||||
return (c.b == 1);
|
||||
return if (c.b == 1) "OK" else "fail: ${c.b}"
|
||||
}
|
||||
+2
-2
@@ -8,8 +8,8 @@ class MyInt(i: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var t = MyInt(0)
|
||||
t++;
|
||||
return (t.b == 0)
|
||||
return if (t.b == 0) "OK" else "fail: ${t.b}"
|
||||
}
|
||||
+2
-2
@@ -8,8 +8,8 @@ class MyInt(i: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var t = MyInt(0)
|
||||
t++;
|
||||
return (t.b == 1)
|
||||
return if (t.b == 1) "OK" else "fail: ${t.b}"
|
||||
}
|
||||
+2
-2
@@ -7,9 +7,9 @@ class A() {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var c = A()
|
||||
val d = c;
|
||||
c %= A();
|
||||
return (c != d) && (c.p == "yeah")
|
||||
return if ((c != d) && (c.p == "yeah")) "OK" else "fail"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
|
||||
operator fun div(other: A) = "hooray"
|
||||
|
||||
}
|
||||
|
||||
fun box() = ((A() / A()) == "hooray")
|
||||
@@ -1,11 +0,0 @@
|
||||
package foo
|
||||
|
||||
|
||||
class A(t: Int) {
|
||||
var i = t
|
||||
operator fun compareTo(other: A) = (this.i - other.i)
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
return (A(3) > A(2)) && (A(2) >= A(2)) && (A(1) >= A(0)) && (A(2) <= A(2)) && (A(3) <= A(4)) && (A(0) < A(100))
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package foo
|
||||
|
||||
|
||||
class A(t: Int) {
|
||||
var i = t
|
||||
infix operator fun compareTo(other: A) = (this.i - other.i)
|
||||
}
|
||||
|
||||
fun box(): Boolean =
|
||||
(A(3) compareTo A(2) > 0) &&
|
||||
(A(2) compareTo A(2) == 0) &&
|
||||
(A(1) compareTo A(0) > 0) &&
|
||||
(A(3) compareTo A(4) < 0) &&
|
||||
(A(0) compareTo A(100) < 0)
|
||||
@@ -1,9 +0,0 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
|
||||
operator fun not() = "hooray"
|
||||
|
||||
}
|
||||
|
||||
fun box() = (!A() == "hooray")
|
||||
Vendored
-13
@@ -1,13 +0,0 @@
|
||||
package foo
|
||||
|
||||
class A(val c: Int) {
|
||||
}
|
||||
|
||||
|
||||
operator fun A.inc() = A(5)
|
||||
operator fun A.dec() = A(10)
|
||||
|
||||
fun box(): Boolean {
|
||||
var a = A(1)
|
||||
return ((++a).c == 5 && (a++).c == 5 && (--a).c == 10 && (a--).c == 10)
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
|
||||
operator fun unaryPlus() = "hooray"
|
||||
operator fun unaryMinus() = "not really"
|
||||
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
var c = A()
|
||||
return (+c + -c == "hooraynot really")
|
||||
}
|
||||
Reference in New Issue
Block a user