diff --git a/js/js.tests/test/org/jetbrains/k2js/test/BasicTest.java b/js/js.tests/test/org/jetbrains/k2js/test/BasicTest.java index 105d617d703..c05ff0f0d9f 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/BasicTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/BasicTest.java @@ -49,6 +49,9 @@ public abstract class BasicTest extends KotlinTestWithEnvironment { private static final String OUT = "out/"; private static final String EXPECTED = "expected/"; + public static final String TEST_PACKAGE = "foo"; + public static final String TEST_FUNCTION = "box"; + @NotNull private String mainDirectory = ""; diff --git a/js/js.tests/test/org/jetbrains/k2js/test/SingleFileTranslationTest.java b/js/js.tests/test/org/jetbrains/k2js/test/SingleFileTranslationTest.java index 53b905f1138..663328b561b 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/SingleFileTranslationTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/SingleFileTranslationTest.java @@ -47,15 +47,15 @@ public abstract class SingleFileTranslationTest extends BasicTest { } public void checkFooBoxIsTrue(@NotNull String filename, @NotNull Iterable ecmaVersions) throws Exception { - runFunctionOutputTest(ecmaVersions, filename, "foo", "box", true); + runFunctionOutputTest(ecmaVersions, filename, TEST_PACKAGE, TEST_FUNCTION, true); } public void checkFooBoxIsTrue(@NotNull String filename) throws Exception { - runFunctionOutputTest(DEFAULT_ECMA_VERSIONS, filename, "foo", "box", true); + runFunctionOutputTest(DEFAULT_ECMA_VERSIONS, filename, TEST_PACKAGE, TEST_FUNCTION, true); } public void checkFooBoxIsValue(@NotNull String filename, @NotNull Iterable ecmaVersions, Object expected) throws Exception { - runFunctionOutputTest(ecmaVersions, filename, "foo", "box", expected); + runFunctionOutputTest(ecmaVersions, filename, TEST_PACKAGE, TEST_FUNCTION, expected); } protected void fooBoxTest() throws Exception { @@ -79,7 +79,7 @@ public abstract class SingleFileTranslationTest extends BasicTest { } protected void checkFooBoxIsOk(@NotNull Iterable versions, @NotNull String filename) throws Exception { - runFunctionOutputTest(versions, filename, "foo", "box", "OK"); + runFunctionOutputTest(versions, filename, TEST_PACKAGE, TEST_FUNCTION, "OK"); } protected void checkOutput(@NotNull String kotlinFilename, diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java index ae3027c2e1a..6d554c7b7fa 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ClassInheritanceTest.java @@ -25,7 +25,7 @@ public final class ClassInheritanceTest extends SingleFileTranslationTest { } public void testInitializersOfBasicClassExecute() throws Exception { - runFunctionOutputTest("initializersOfBasicClassExecute.kt", "foo", "box", 3); + fooBoxIsValue(3); } public void testMethodOverride() throws Exception { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExamplesTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExamplesTest.java index b7abf01bc27..36b301a4d2a 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExamplesTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/ExamplesTest.java @@ -36,7 +36,7 @@ public final class ExamplesTest extends SingleFileTranslationTest { @Override public void runTest() throws Exception { - runFunctionOutputTest(filename, Namer.getRootPackageName(), "box", "OK"); + runFunctionOutputTest(filename, Namer.getRootPackageName(), TEST_FUNCTION, "OK"); } public static Test suite() throws Exception { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/FunctionTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/FunctionTest.java index d8aead859ab..e89e8228992 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/FunctionTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/FunctionTest.java @@ -51,15 +51,15 @@ public class FunctionTest extends AbstractExpressionTest { } public void testClosureWithParameter() throws Exception { - checkFooBoxIsOk("closureWithParameter.kt"); + checkFooBoxIsOk(); } public void testClosureWithParameterAndBoxing() throws Exception { - checkFooBoxIsOk("closureWithParameterAndBoxing.kt"); + checkFooBoxIsOk(); } public void testEnclosingThis() throws Exception { - runFunctionOutputTest("enclosingThis.kt", "foo", "box", "OK"); + checkFooBoxIsOk(); } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PackageTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PackageTest.java index 046a79f1998..ef6c99236fe 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PackageTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PackageTest.java @@ -24,25 +24,22 @@ public final class PackageTest extends SingleFileTranslationTest { } public void testNestedPackage() throws Exception { - runFunctionOutputTest("nestedPackage.kt", "foo.bar", "box", true); + runFunctionOutputTest("nestedPackage.kt", "foo.bar", TEST_FUNCTION, true); } public void testDeeplyNestedPackage() throws Exception { - runFunctionOutputTest("deeplyNestedPackage.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true); + runFunctionOutputTest("deeplyNestedPackage.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", TEST_FUNCTION, true); } public void testDeeplyNestedPackageFunctionCalled() throws Exception { - runFunctionOutputTest("deeplyNestedPackageFunctionCalled.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true - ); + runFunctionOutputTest("deeplyNestedPackageFunctionCalled.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", TEST_FUNCTION, true); } public void testClassCreatedInDeeplyNestedPackage() throws Exception { - runFunctionOutputTest("classCreatedInDeeplyNestedPackage.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true - ); + runFunctionOutputTest("classCreatedInDeeplyNestedPackage.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", TEST_FUNCTION, true); } public void testInitializersOfNestedPackagesExecute() throws Exception { - runFunctionOutputTest("initializersOfNestedPackagesExecute.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", "box", true - ); + runFunctionOutputTest("initializersOfNestedPackagesExecute.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", TEST_FUNCTION, true); } } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java index 8a2de753ab0..3d42778515d 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PatternMatchingTest.java @@ -54,7 +54,7 @@ public final class PatternMatchingTest extends SingleFileTranslationTest { } public void testMultipleCases() throws Exception { - runFunctionOutputTest("multipleCases.kt", "foo", "box", 2.0); + fooBoxIsValue(2.0); } public void testMatchNullableType() throws Exception { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java index 3c1a3586408..c0c08ebd70b 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/PropertyAccessTest.java @@ -43,7 +43,7 @@ public final class PropertyAccessTest extends SingleFileTranslationTest { } public void testSetter() throws Exception { - runFunctionOutputTest("setter.kt", "foo", "f", 99.0); + fooBoxIsValue(99.0); } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibTest.java b/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibTest.java index 1e477f6b8ca..ccec165f547 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/semantics/StdLibTest.java @@ -49,7 +49,7 @@ public final class StdLibTest extends SingleFileTranslationTest { generateJavaScriptFiles(files, kotlinFilename, mainCallParameters, ecmaVersions); runRhinoTests(kotlinFilename, ecmaVersions, - new RhinoFunctionNativeObjectResultChecker("test.browser", "foo", "Some Dynamically Created Content!!!")); + new RhinoFunctionNativeObjectResultChecker("test.browser", TEST_FUNCTION, "Some Dynamically Created Content!!!")); } @Override diff --git a/js/js.translator/testFiles/propertyAccess/cases/setter.kt b/js/js.translator/testFiles/propertyAccess/cases/setter.kt index fe345652ded..377ff8c8693 100644 --- a/js/js.translator/testFiles/propertyAccess/cases/setter.kt +++ b/js/js.translator/testFiles/propertyAccess/cases/setter.kt @@ -4,7 +4,7 @@ class Test() { var a : Int = 1 } -fun f() : Int { +fun box() : Int { var a = Test() var b = Test() b.a = 100 diff --git a/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt b/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt index 0aefd318baf..009184443f5 100644 --- a/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt +++ b/js/js.translator/testFiles/stdlib/cases/browserDocumentAccess.kt @@ -3,7 +3,7 @@ package test.browser import js.dom.html.document import org.w3c.dom.Node -fun foo(): String { +fun box(): String { val element = document.getElementById("foo")!! val textNode = document.createTextNode("Some Dynamically Created Content!!!") element.appendChild(textNode)