JS: move more test to box tests
This commit is contained in:
@@ -5243,6 +5243,81 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/objectDeclaration")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ObjectDeclaration extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInObjectDeclaration() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/objectDeclaration"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("dontPolluteObject.kt")
|
||||
public void testDontPolluteObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/dontPolluteObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt3684.kt")
|
||||
public void testKt3684() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/kt3684.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("lambdaInObjectInsideObject.kt")
|
||||
public void testLambdaInObjectInsideObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/lambdaInObjectInsideObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectDeclaration.kt")
|
||||
public void testObjectDeclaration() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectDeclaration.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectDeclarationWithVars.kt")
|
||||
public void testObjectDeclarationWithVars() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectDeclarationWithVars.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInMethod.kt")
|
||||
public void testObjectInMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectInMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInObject.kt")
|
||||
public void testObjectInObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectInObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInObjectWithClosure.kt")
|
||||
public void testObjectInObjectWithClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectInObjectWithClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInheritingFromATrait.kt")
|
||||
public void testObjectInheritingFromATrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectInheritingFromATrait.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectInheritingFromClass.kt")
|
||||
public void testObjectInheritingFromClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectInheritingFromClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("objectWithMethods.kt")
|
||||
public void testObjectWithMethods() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/objectDeclaration/objectWithMethods.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/operatorOverloading")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -5383,4 +5458,265 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/propertyAccess")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PropertyAccess extends AbstractBoxJsTest {
|
||||
@TestMetadata("accessToInstanceProperty.kt")
|
||||
public void testAccessToInstanceProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/accessToInstanceProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInPropertyAccess() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/propertyAccess"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("classUsesPackageProperties.kt")
|
||||
public void testClassUsesPackageProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/classUsesPackageProperties.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("customGetter.kt")
|
||||
public void testCustomGetter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/customGetter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("customSetter.kt")
|
||||
public void testCustomSetter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/customSetter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumerable.kt")
|
||||
public void testEnumerable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/enumerable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionLiteralSafeCall.kt")
|
||||
public void testExtensionLiteralSafeCall() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/extensionLiteralSafeCall.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("field.kt")
|
||||
public void testField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/field.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initInstanceProperties.kt")
|
||||
public void testInitInstanceProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/initInstanceProperties.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initValInConstructor.kt")
|
||||
public void testInitValInConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/initValInConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("nativePropertiesNameClashes.kt")
|
||||
public void testNativePropertiesNameClashes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/nativePropertiesNameClashes.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadedOverriddenFunctionPropertyName.kt")
|
||||
public void testOverloadedOverriddenFunctionPropertyName() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/overloadedOverriddenFunctionPropertyName.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("packageCustomAccessors.kt")
|
||||
public void testPackageCustomAccessors() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/packageCustomAccessors.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("packagePropertyInitializer.kt")
|
||||
public void testPackagePropertyInitializer() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/packagePropertyInitializer.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("packagePropertySet.kt")
|
||||
public void testPackagePropertySet() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/packagePropertySet.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("privatePropertyAccessFromMethod.kt")
|
||||
public void testPrivatePropertyAccessFromMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/privatePropertyAccessFromMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyAssignment.kt")
|
||||
public void testPropertyAssignment() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/propertyAssignment.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("setter.kt")
|
||||
public void testSetter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/setter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("twoClassesWithProperties.kt")
|
||||
public void testTwoClassesWithProperties() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyAccess/twoClassesWithProperties.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/propertyOverride")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class PropertyOverride extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInPropertyOverride() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/propertyOverride"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("checkSupertypeOrder.kt")
|
||||
public void testCheckSupertypeOrder() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/checkSupertypeOrder.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initOverrideInConstructor.kt")
|
||||
public void testInitOverrideInConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/initOverrideInConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initOverrideInConstructorComplex.kt")
|
||||
public void testInitOverrideInConstructorComplex() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/initOverrideInConstructorComplex.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initOverrideInConstructorExplicitThis.kt")
|
||||
public void testInitOverrideInConstructorExplicitThis() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/initOverrideInConstructorExplicitThis.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initOverrideVarInConstructor.kt")
|
||||
public void testInitOverrideVarInConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/initOverrideVarInConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPrivateVal.kt")
|
||||
public void testOverloadPrivateVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/overloadPrivateVal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideExtensionProperty.kt")
|
||||
public void testOverrideExtensionProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/overrideExtensionProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideNotDirectlySuper.kt")
|
||||
public void testOverrideNotDirectlySuper() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/overrideNotDirectlySuper.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideValFromTraits.kt")
|
||||
public void testOverrideValFromTraits() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/overrideValFromTraits.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overrideValWithBackendFiled.kt")
|
||||
public void testOverrideValWithBackendFiled() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/overrideValWithBackendFiled.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simpleOverride.kt")
|
||||
public void testSimpleOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/propertyOverride/simpleOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/range")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Range extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInRange() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/range"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("creatingProgressions.kt")
|
||||
public void testCreatingProgressions() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/creatingProgressions.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("explicitRange.kt")
|
||||
public void testExplicitRange() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/explicitRange.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("intDownTo.kt")
|
||||
public void testIntDownTo() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/intDownTo.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("intInRange.kt")
|
||||
public void testIntInRange() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/intInRange.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("intUpTo.kt")
|
||||
public void testIntUpTo() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/intUpTo.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("iteratingOverRanges.kt")
|
||||
public void testIteratingOverRanges() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/iteratingOverRanges.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("rangeEquals.kt")
|
||||
public void testRangeEquals() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/rangeEquals.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("rangeSugarSyntax.kt")
|
||||
public void testRangeSugarSyntax() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/rangeSugarSyntax.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("rangeToDoesNotIterate.kt")
|
||||
public void testRangeToDoesNotIterate() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/rangeToDoesNotIterate.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("reverse.kt")
|
||||
public void testReverse() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/range/reverse.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,70 +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 ObjectTest extends SingleFileTranslationTest {
|
||||
|
||||
public ObjectTest() {
|
||||
super("object/");
|
||||
}
|
||||
|
||||
public void testObjectWithMethods() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testObjectDeclaration() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testObjectDeclarationWithVars() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testObjectInMethod() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testObjectInObject() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testObjectInheritingFromATrait() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testObjectInheritingFromClass() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testObjectInObjectWithClosure() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testLambdaInObjectInsideObject() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testDontPolluteObject() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testKt3684() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
@@ -1,118 +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.common.collect.Lists;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.js.config.EcmaVersion;
|
||||
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public final class PropertyAccessTest extends SingleFileTranslationTest {
|
||||
|
||||
public PropertyAccessTest() {
|
||||
super("propertyAccess/");
|
||||
}
|
||||
|
||||
public void testAccessToInstanceProperty() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testTwoClassesWithProperties() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testSetter() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
|
||||
public void testCustomGetter() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testCustomSetter() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testPackagePropertyInitializer() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testPackagePropertySet() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testPackageCustomAccessors() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testClassUsesPackageProperties() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testExtensionLiteralSafeCall() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testInitInstanceProperties() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testInitValInConstructor() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testEnumerable() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testOverloadedOverriddenFunctionPropertyName() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testNativePropertiesNameClashes() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testField() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testPropertyAssignment() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testPrivatePropertyAccessFromMethod() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected List<String> additionalJsFiles(@NotNull EcmaVersion ecmaVersion) {
|
||||
List<String> result = Lists.newArrayList(super.additionalJsFiles(ecmaVersion));
|
||||
if (getName().equals("testEnumerable")) {
|
||||
result.add(pathToTestDir() + "enumerate.js");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,70 +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 org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
|
||||
public class PropertyOverrideTest extends SingleFileTranslationTest {
|
||||
|
||||
public PropertyOverrideTest() {
|
||||
super("propertyOverride/");
|
||||
}
|
||||
|
||||
public void testOverrideValWithBackendFiled() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testSimpleOverride() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testOverloadPrivateVal() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testOverrideValFromTraits() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testCheckSupertypeOrder() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testOverrideNotDirectlySuper() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testOverrideExtensionProperty() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testInitOverrideInConstructor() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testInitOverrideInConstructorExplicitThis() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testInitOverrideInConstructorComplex() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testInitOverrideVarInConstructor() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
@@ -1,68 +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 org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
|
||||
public final class RangeTest extends SingleFileTranslationTest {
|
||||
|
||||
public RangeTest() {
|
||||
super("range/");
|
||||
}
|
||||
|
||||
public void testCreatingProgressions() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testExplicitRange() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testRangeSugarSyntax() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testIntInRange() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testIteratingOverRanges() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testIntUpTo() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testRangeToDoesNotIterate() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testRangeEquals() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testIntDownTo() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testReverse() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package foo
|
||||
|
||||
class A {
|
||||
|
||||
}
|
||||
|
||||
object test {
|
||||
var c = 2;
|
||||
var b = 1;
|
||||
}
|
||||
|
||||
object aWrapper {
|
||||
var a = A();
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (test.c != 2) return "fail1: ${test.c}"
|
||||
|
||||
if (test.b != 1) return "fail2: ${test.b}"
|
||||
test.c += 10
|
||||
if (test.c != 12) "fail3: ${test.c}"
|
||||
if (aWrapper.a !is A) "fail4"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package foo
|
||||
|
||||
object State {
|
||||
val c = 2
|
||||
val b = 1
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (State.c != 2) return "fail1: ${State.c}"
|
||||
if (State.b != 1) return "fail2: ${State.b}"
|
||||
return "OK"
|
||||
}
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
fun f(): Boolean {
|
||||
fun f(): String {
|
||||
val z = object {
|
||||
val c = true
|
||||
val c = "OK"
|
||||
}
|
||||
return z.c
|
||||
}
|
||||
+3
-3
@@ -2,7 +2,7 @@ package foo
|
||||
|
||||
class Foo {
|
||||
fun bar(param: String): String {
|
||||
val local = "world!"
|
||||
val local = "K"
|
||||
var a = object {
|
||||
val b = object {
|
||||
val bar = param + local
|
||||
@@ -12,7 +12,7 @@ class Foo {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
return Foo().bar("hello ") == "hello world!"
|
||||
fun box(): String {
|
||||
return Foo().bar("O")
|
||||
}
|
||||
|
||||
+3
-3
@@ -14,11 +14,11 @@ object foo : Foo {
|
||||
}
|
||||
}
|
||||
|
||||
private var result = false
|
||||
private var result = "fail"
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
foo.execute() {
|
||||
result = true
|
||||
result = "OK"
|
||||
}
|
||||
|
||||
return result
|
||||
+1
-1
@@ -6,4 +6,4 @@ abstract class A(val s: String) {
|
||||
object B : A("test") {
|
||||
}
|
||||
|
||||
fun box() = B.s == "test"
|
||||
fun box() = if (B.s == "test") "OK" else "fail: ${B.s}"
|
||||
+5
-5
@@ -6,17 +6,17 @@ class Test {
|
||||
fun b() = 2
|
||||
}
|
||||
|
||||
fun doTest(): Boolean {
|
||||
fun doTest(): String {
|
||||
if (a.c() != 3) {
|
||||
return false;
|
||||
return "fail1"
|
||||
}
|
||||
if (a.b() != 2) {
|
||||
return false;
|
||||
return "fail2"
|
||||
}
|
||||
return true;
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
return Test().doTest();
|
||||
}
|
||||
+2
-2
@@ -4,8 +4,8 @@ class Test() {
|
||||
var a: Int = 100
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var test = Test()
|
||||
test.a = 1
|
||||
return (1 == test.a)
|
||||
return if (1 == test.a) "OK" else "fail: ${test.a}"
|
||||
}
|
||||
+2
-2
@@ -9,9 +9,9 @@ class A() {
|
||||
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var c = A()
|
||||
c = A()
|
||||
c = A()
|
||||
return (a == 3)
|
||||
return if (a == 3) "OK" else "fail: $a"
|
||||
}
|
||||
+2
-2
@@ -7,7 +7,7 @@ class Test() {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var test = Test()
|
||||
return (test.a == 5)
|
||||
return if (test.a == 5) "OK" else "fail: ${test.a}"
|
||||
}
|
||||
+2
-2
@@ -7,8 +7,8 @@ class Test() {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
var test = Test()
|
||||
test.a = 5
|
||||
return (test.a == 3)
|
||||
return if (test.a == 3) "OK" else "fail: ${test.a}"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// FILE: enumerable.kt
|
||||
package foo
|
||||
|
||||
@native
|
||||
fun <T> _enumerate(o: T): T = noImpl
|
||||
|
||||
@native
|
||||
fun <T> _findFirst(o: Any): T = noImpl
|
||||
|
||||
class Test() {
|
||||
val a: Int = 100
|
||||
val b: String = "s"
|
||||
}
|
||||
|
||||
class P() {
|
||||
@enumerable
|
||||
val a: Int = 100
|
||||
val b: String = "s"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val test = _enumerate(Test())
|
||||
val p = _enumerate(P())
|
||||
if (100 != test.a) return "fail1: ${test.a}"
|
||||
if ("s" != test.b) return "fail2: ${test.b}"
|
||||
if (p.a != 100) return "fail3: ${p.a}"
|
||||
|
||||
val result = _findFirst<Int>(object {
|
||||
val test = 100
|
||||
})
|
||||
if (result != 100) return "fail4: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: enumerate.js
|
||||
function _enumerate(o) {
|
||||
var r = {};
|
||||
for (var p in o) {
|
||||
r[p] = o[p];
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function _findFirst(o) {
|
||||
for (var p in o) {
|
||||
return o[p];
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -2,13 +2,13 @@ package foo
|
||||
|
||||
fun f(a: Int?, b: Int.(Int) -> Int) = a?.b(2)
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
val c1 = f (null) {
|
||||
it + this
|
||||
} != null
|
||||
if (c1) return false;
|
||||
if (c1) return "fail1"
|
||||
if (f(3) {
|
||||
it + this
|
||||
} != 5) return false
|
||||
return true;
|
||||
} != 5) return "fail2"
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package foo
|
||||
|
||||
class Test() {
|
||||
val a: Int = 100
|
||||
var b: Int = a
|
||||
val c: Int = a + b
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val test = Test()
|
||||
if (100 != test.a) return "fail1: ${test.a}"
|
||||
if (100 != test.b) return "fail2: ${test.b}"
|
||||
if (200 != test.c) return "fail3: ${test.c}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+3
-3
@@ -6,7 +6,7 @@ interface I {
|
||||
|
||||
class P : I {
|
||||
override fun test(): String {
|
||||
return "a" + test("b")
|
||||
return "O" + test("K")
|
||||
}
|
||||
|
||||
private fun test(p: String): String {
|
||||
@@ -14,6 +14,6 @@ class P : I {
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
return P().test() == "ab"
|
||||
fun box(): String {
|
||||
return P().test()
|
||||
}
|
||||
+2
-2
@@ -10,6 +10,6 @@ var a: Int
|
||||
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
return (a == 5)
|
||||
fun box(): String {
|
||||
return if (a == 5) "OK" else "fail: $a"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package foo
|
||||
|
||||
val b = 3
|
||||
|
||||
fun box() = if (b == 3) "OK" else "fail: $b"
|
||||
@@ -0,0 +1,8 @@
|
||||
package foo
|
||||
|
||||
var b = 3
|
||||
|
||||
fun box(): String {
|
||||
b = 2
|
||||
return if (b == 2) "OK" else "fail: $b"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
val a: Int = 1
|
||||
}
|
||||
|
||||
class B() {
|
||||
val b: Int = 2
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (A().a != 1) return "fail1"
|
||||
if (B().b != 2) return "fail2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package foo
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
|
||||
val intProgression = IntProgression.fromClosedRange(0, 10, 2)
|
||||
assertEquals(10, intProgression.last)
|
||||
@@ -11,5 +11,5 @@ fun box(): Boolean {
|
||||
val charProgression = CharProgression.fromClosedRange('a', 'z', 2)
|
||||
assertEquals('y', charProgression.last)
|
||||
|
||||
return true
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var twoToFive = IntRange(2, 5)
|
||||
|
||||
if (twoToFive.contains(6)) return "fail1"
|
||||
if (twoToFive.contains(1)) return "fail2"
|
||||
if (twoToFive.contains(0)) return "fail3"
|
||||
if (twoToFive.contains(-100)) return "fail4"
|
||||
if (twoToFive.contains(10)) return "fail5"
|
||||
if (!twoToFive.contains(2)) return "fail6"
|
||||
if (!twoToFive.contains(3)) return "fail7"
|
||||
if (!twoToFive.contains(4)) return "fail8"
|
||||
if (!twoToFive.contains(5)) return "fail9"
|
||||
if (!(twoToFive.start == 2)) return "fail10"
|
||||
if (!(twoToFive.endInclusive == 5)) return "fail11"
|
||||
|
||||
var sum = 0;
|
||||
for (i in twoToFive) {
|
||||
sum += i;
|
||||
}
|
||||
|
||||
if (sum != 14) return "fail12"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package foo
|
||||
|
||||
|
||||
fun box(): String {
|
||||
|
||||
if (1 in -2..0) return "fail1"
|
||||
if (1 in -10..-4) return "fail2"
|
||||
if (!(1 in 0..2)) return "fail3"
|
||||
|
||||
if (!(1 in 1..2)) return "fail4"
|
||||
if (!(1 in -2..5)) return "fail5"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package foo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
fun box(): String {
|
||||
var elems = ArrayList<Int>()
|
||||
for (i in 0.rangeTo(5)) {
|
||||
elems.add(i)
|
||||
}
|
||||
if (elems[0] != 0) return "fail1: ${elems[0]}"
|
||||
if (elems[1] != 1) return "fail2: ${elems[1]}"
|
||||
if (elems[2] != 2) return "fail3: ${elems[2]}"
|
||||
if (elems[3] != 3) return "fail4: ${elems[3]}"
|
||||
if (elems[4] != 4) return "fail5: ${elems[4]}"
|
||||
if (elems[5] != 5) return "fail6: ${elems[5]}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+6
-6
@@ -1,18 +1,18 @@
|
||||
package foo
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
|
||||
var d = 0
|
||||
for (i in 1..6) {
|
||||
d += i
|
||||
}
|
||||
if (d != 21) return false;
|
||||
if (d != 21) return "fail1: $d"
|
||||
|
||||
for (x in 100..199) {
|
||||
d += 1
|
||||
}
|
||||
if (d != 121) {
|
||||
return false;
|
||||
return "fail2: $d"
|
||||
}
|
||||
|
||||
for (y in 1..1) {
|
||||
@@ -20,7 +20,7 @@ fun box(): Boolean {
|
||||
}
|
||||
|
||||
if (d != 100) {
|
||||
return false;
|
||||
return "fail3: $d"
|
||||
}
|
||||
|
||||
for (c in 100..100) {
|
||||
@@ -28,8 +28,8 @@ fun box(): Boolean {
|
||||
}
|
||||
|
||||
if (d != 101) {
|
||||
return false;
|
||||
return "fail4: $d"
|
||||
}
|
||||
return true
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(true, 2..1 == 4..2, "2..1 == 4..2")
|
||||
assertEquals(true, 2L..1L == 318238945677L..2L, "2L..1L == 318238945677L..2L")
|
||||
assertEquals(false, (2..1) as Any == (4L..2L) as Any, "(2..1): Any == (4L..2L): Any")
|
||||
assertEquals(true, 'B'..'A' == 'W'..'B', "'B'..'A' == 'W'..'B'")
|
||||
assertEquals(false, (2..1) as Any == ('B'..'A') as Any, "(2..1): Any == ('B'..'A'): Any")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
var twoToFive = 2..5
|
||||
|
||||
if (twoToFive.contains(6)) return "fail1"
|
||||
if (twoToFive.contains(1)) return "fail2"
|
||||
if (twoToFive.contains(0)) return "fail3"
|
||||
if (twoToFive.contains(-100)) return "fail4"
|
||||
if (twoToFive.contains(10)) return "fail5"
|
||||
if (!twoToFive.contains(2)) return "fail6"
|
||||
if (!twoToFive.contains(3)) return "fail7"
|
||||
if (!twoToFive.contains(4)) return "fail8"
|
||||
if (!twoToFive.contains(5)) return "fail9"
|
||||
if (!(twoToFive.start == 2)) return "fail10"
|
||||
if (!(twoToFive.endInclusive == 5)) return "fail11"
|
||||
|
||||
var sum = 0;
|
||||
for (i in twoToFive) {
|
||||
sum += i;
|
||||
}
|
||||
|
||||
if (sum != 14) return "fail12"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+3
-3
@@ -2,9 +2,9 @@ package foo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
fun box(): Boolean {
|
||||
fun box(): String {
|
||||
for (i in 0.rangeTo(-1)) {
|
||||
return false
|
||||
return "fail"
|
||||
}
|
||||
return true
|
||||
return "OK"
|
||||
}
|
||||
Vendored
@@ -1,28 +0,0 @@
|
||||
package foo
|
||||
|
||||
class A {
|
||||
|
||||
}
|
||||
|
||||
object test {
|
||||
var c = 2;
|
||||
var b = 1;
|
||||
}
|
||||
|
||||
object aWrapper {
|
||||
var a = A();
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
if (test.c != 2) return false;
|
||||
|
||||
if (test.b != 1) return false;
|
||||
test.c += 10
|
||||
if (test.c != 12) {
|
||||
return false;
|
||||
}
|
||||
if (aWrapper.a !is A) {
|
||||
return false
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package foo
|
||||
|
||||
object State {
|
||||
val c = 2
|
||||
val b = 1
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
if (State.c != 2) return false
|
||||
if (State.b != 1) return false
|
||||
return true
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package foo
|
||||
|
||||
@native
|
||||
fun <T> _enumerate(o: T): T = noImpl
|
||||
|
||||
@native
|
||||
fun <T> _findFirst(o: Any): T = noImpl
|
||||
|
||||
class Test() {
|
||||
val a: Int = 100
|
||||
val b: String = "s"
|
||||
}
|
||||
|
||||
class P() {
|
||||
@enumerable
|
||||
val a: Int = 100
|
||||
val b: String = "s"
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
val test = _enumerate(Test())
|
||||
val p = _enumerate(P())
|
||||
return (100 == test.a && "s" == test.b) && p.a == 100 && _findFirst<Int>(object {
|
||||
val test = 100
|
||||
}) == 100;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package foo
|
||||
|
||||
class Test() {
|
||||
val a: Int = 100
|
||||
var b: Int = a
|
||||
val c: Int = a + b
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
val test = Test()
|
||||
return (100 == test.a && 100 == test.b && 200 == test.c)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package foo
|
||||
|
||||
val b = 3
|
||||
|
||||
fun box() = (b == 3)
|
||||
@@ -1,8 +0,0 @@
|
||||
package foo
|
||||
|
||||
var b = 3
|
||||
|
||||
fun box(): Boolean {
|
||||
b = 2
|
||||
return (b == 2)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package foo
|
||||
|
||||
class A() {
|
||||
val a: Int = 1
|
||||
}
|
||||
|
||||
class B() {
|
||||
val b: Int = 2
|
||||
}
|
||||
|
||||
fun box(): Boolean {
|
||||
return ((A().a == 1) && (B().b == 2));
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
function _enumerate(o) {
|
||||
var r = {};
|
||||
for (var p in o) {
|
||||
r[p] = o[p];
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function _findFirst(o) {
|
||||
for (var p in o) {
|
||||
return o[p];
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package foo
|
||||
|
||||
fun box(): Boolean {
|
||||
|
||||
var twoToFive = IntRange(2, 5)
|
||||
|
||||
if (twoToFive.contains(6)) return false;
|
||||
if (twoToFive.contains(1)) return false;
|
||||
if (twoToFive.contains(0)) return false;
|
||||
if (twoToFive.contains(-100)) return false;
|
||||
if (twoToFive.contains(10)) return false;
|
||||
if (!twoToFive.contains(2)) return false;
|
||||
if (!twoToFive.contains(3)) return false;
|
||||
if (!twoToFive.contains(4)) return false;
|
||||
if (!twoToFive.contains(5)) return false;
|
||||
if (!(twoToFive.start == 2)) return false;
|
||||
if (!(twoToFive.endInclusive == 5)) return false;
|
||||
|
||||
var sum = 0;
|
||||
for (i in twoToFive) {
|
||||
sum += i;
|
||||
}
|
||||
|
||||
if (sum != 14) return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package foo
|
||||
|
||||
|
||||
fun box(): Boolean {
|
||||
|
||||
if (1 in -2..0) return false;
|
||||
if (1 in -10..-4) return false;
|
||||
if (!(1 in 0..2)) return false;
|
||||
|
||||
if (!(1 in 1..2)) return false;
|
||||
if (!(1 in -2..5)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package foo
|
||||
|
||||
import java.util.ArrayList
|
||||
|
||||
fun box(): Boolean {
|
||||
var elems = ArrayList<Int>()
|
||||
for (i in 0.rangeTo(5)) {
|
||||
elems.add(i)
|
||||
}
|
||||
return elems[0] == 0 && elems[1] == 1 && elems[2] == 2 && elems[3] == 3 && elems[4] == 4 && elems[5] == 5
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
|
||||
assertEquals(true, 2..1 == 4..2, "2..1 == 4..2")
|
||||
assertEquals(true, 2L..1L == 318238945677L..2L, "2L..1L == 318238945677L..2L")
|
||||
assertEquals(false, (2..1) as Any == (4L..2L) as Any, "(2..1): Any == (4L..2L): Any")
|
||||
assertEquals(true, 'B'..'A' == 'W'..'B', "'B'..'A' == 'W'..'B'")
|
||||
assertEquals(false, (2..1) as Any == ('B'..'A') as Any, "(2..1): Any == ('B'..'A'): Any")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package foo
|
||||
|
||||
fun box(): Boolean {
|
||||
|
||||
var twoToFive = 2..5
|
||||
|
||||
if (twoToFive.contains(6)) return false;
|
||||
if (twoToFive.contains(1)) return false;
|
||||
if (twoToFive.contains(0)) return false;
|
||||
if (twoToFive.contains(-100)) return false;
|
||||
if (twoToFive.contains(10)) return false;
|
||||
if (!twoToFive.contains(2)) return false;
|
||||
if (!twoToFive.contains(3)) return false;
|
||||
if (!twoToFive.contains(4)) return false;
|
||||
if (!twoToFive.contains(5)) return false;
|
||||
if (!(twoToFive.start == 2)) return false;
|
||||
if (!(twoToFive.endInclusive == 5)) return false;
|
||||
|
||||
var sum = 0;
|
||||
for (i in twoToFive) {
|
||||
sum += i;
|
||||
}
|
||||
|
||||
if (sum != 14) return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user