diff --git a/.idea/artifacts/k2js_jar.xml b/.idea/artifacts/k2js_jar.xml index 0d9863a55f6..eb3b4c0e9ab 100644 --- a/.idea/artifacts/k2js_jar.xml +++ b/.idea/artifacts/k2js_jar.xml @@ -14,7 +14,6 @@ - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 557326f86f1..3b81bbcf7fc 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -4,12 +4,12 @@ + - diff --git a/examples/test/ExampleTestSuite.java b/examples/test/ExampleTestSuite.java deleted file mode 100644 index 9274155c810..00000000000 --- a/examples/test/ExampleTestSuite.java +++ /dev/null @@ -1,34 +0,0 @@ -import com.intellij.testFramework.UsefulTestCase; -import junit.framework.Test; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.k2js.test.ExampleTest; - -public final class ExampleTestSuite extends UsefulTestCase { - - private String name; - private ExampleTest tester = new ExampleTest(); - - public ExampleTestSuite(String name) { - this.name = name; - } - - @Override - public String getName() { - return name; - } - - public void runTest() throws Exception { - tester.runBoxTest(getName()); - } - - public static Test suite() { - return JetTestCaseBuilder.suiteForDirectory("translator", - "/testFiles/examples/cases/", true, new JetTestCaseBuilder.NamedTestFactory() { - @NotNull - @Override - public Test createTest(@NotNull String dataPath, @NotNull String name) { - return (new ExampleTestSuite(name)); - } - }); - } -} diff --git a/jslib/src/core/javautil.kt b/jslib/src/core/javautil.kt index 098cd198ff2..b2ea97fe65f 100644 --- a/jslib/src/core/javautil.kt +++ b/jslib/src/core/javautil.kt @@ -147,6 +147,25 @@ public open class HashMap() : java.util.Map { override public fun values() : java.util.Collection {} } +library +public open class LinkedList() : List { + override public fun iterator() : java.util.Iterator {} + override public fun isEmpty() : Boolean {} + override public fun contains(o : Any?) : Boolean {} + override public fun size() : Int {} + override public fun add(e : E) : Boolean {} + override public fun remove(o : Any?) : Boolean {} + override public fun addAll(c : java.util.Collection) : Boolean {} + override public fun clear() : Unit {} + override public fun get(index : Int) : E {} + override public fun set(index : Int, element : E) : E {} + override public fun add(index : Int, element : E) : Unit {} + override public fun remove(index : Int) : E {} + public fun poll() : E? {} + public fun peek() : E? {} + public fun offer(e : E) : Boolean {} +} + library public class StringBuilder() { public fun append(obj : Any) : StringBuilder diff --git a/translator/lib/junit-4.10.jar b/translator/lib/junit-4.10.jar deleted file mode 100644 index bf5c0b9c6ad..00000000000 Binary files a/translator/lib/junit-4.10.jar and /dev/null differ diff --git a/translator/test/org/jetbrains/k2js/test/AppletTest.java b/translator/test/org/jetbrains/k2js/test/AppletTest.java index fb2a9972cc7..f67ba3dcdb0 100644 --- a/translator/test/org/jetbrains/k2js/test/AppletTest.java +++ b/translator/test/org/jetbrains/k2js/test/AppletTest.java @@ -2,7 +2,6 @@ package org.jetbrains.k2js.test; import org.jetbrains.k2js.facade.K2JSTranslatorApplet; import org.junit.Assert; -import org.junit.Test; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; @@ -18,14 +17,12 @@ public final class AppletTest extends TranslationTest { return MAIN; } - @Test - public void simpleTest() throws Exception { + public void testSimple() throws Exception { evaluateCodeWithParameters("fun main(args : Array) {}", " a 3 1 2134", ""); } - @Test - public void systemOutTest() throws Exception { + public void testSystemOutTest() throws Exception { evaluateCodeWithParameters("class A() {} fun main(args : Array) { var a = A();}", "", ""); } diff --git a/translator/test/org/jetbrains/k2js/test/ArrayListTest.java b/translator/test/org/jetbrains/k2js/test/ArrayListTest.java index b39e6ded199..7910491899e 100644 --- a/translator/test/org/jetbrains/k2js/test/ArrayListTest.java +++ b/translator/test/org/jetbrains/k2js/test/ArrayListTest.java @@ -1,6 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; import org.mozilla.javascript.JavaScriptException; /** @@ -15,38 +14,36 @@ public final class ArrayListTest extends JavaClassesTest { return MAIN; } - @Test - public void emptyList() throws Exception { + public void testEmptyList() throws Exception { testFooBoxIsTrue("emptyList.kt"); } - @Test - public void access() throws Exception { + public void testAccess() throws Exception { testFooBoxIsTrue("access.kt"); } - @Test - public void isEmpty() throws Exception { + public void testIsEmpty() throws Exception { testFooBoxIsTrue("isEmpty.kt"); } - @Test - public void arrayAccess() throws Exception { + public void testArrayAccess() throws Exception { testFooBoxIsTrue("arrayAccess.kt"); } - @Test - public void iterate() throws Exception { + public void testIterate() throws Exception { testFooBoxIsTrue("iterate.kt"); } - @Test - public void remove() throws Exception { + public void testRemove() throws Exception { testFooBoxIsTrue("remove.kt"); } - @Test(expected = JavaScriptException.class) - public void indexOOB() throws Exception { - testFooBoxIsTrue("indexOOB.kt"); + public void testIndexOOB() throws Exception { + try { + testFooBoxIsTrue("indexOOB.kt"); + fail(); + } catch (JavaScriptException e) { + + } } } diff --git a/translator/test/org/jetbrains/k2js/test/BaseTest.java b/translator/test/org/jetbrains/k2js/test/BaseTest.java new file mode 100644 index 00000000000..f519dcfad13 --- /dev/null +++ b/translator/test/org/jetbrains/k2js/test/BaseTest.java @@ -0,0 +1,35 @@ +package org.jetbrains.k2js.test; + +import com.intellij.openapi.project.Project; +import com.intellij.testFramework.UsefulTestCase; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.jet.JetTestUtils; +import org.jetbrains.jet.compiler.JetCoreEnvironment; + +/** + * @author Pavel Talanov + */ +public abstract class BaseTest extends UsefulTestCase { + @NonNls + protected JetCoreEnvironment myEnvironment; + + public Project getProject() { + return myEnvironment.getProject(); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + // createEnvironmentWithMockJdk(); + } + + @Override + protected void tearDown() throws Exception { + myEnvironment = null; + super.tearDown(); + } + + protected void createEnvironmentWithMockJdk() { + myEnvironment = JetTestUtils.createEnvironmentWithMockJdk(getTestRootDisposable()); + } +} diff --git a/translator/test/org/jetbrains/k2js/test/BasicClassTest.java b/translator/test/org/jetbrains/k2js/test/BasicClassTest.java index 5502499037c..6251c09f49b 100644 --- a/translator/test/org/jetbrains/k2js/test/BasicClassTest.java +++ b/translator/test/org/jetbrains/k2js/test/BasicClassTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,53 +12,44 @@ public class BasicClassTest extends TranslationTest { return MAIN; } - @Test - public void classInstantiation() throws Exception { + + public void testClassInstantiation() throws Exception { testFooBoxIsTrue("classInstantiation.kt"); } - @Test - public void methodDeclarationAndCall() throws Exception { + public void testMethodDeclarationAndCall() throws Exception { testFooBoxIsTrue("methodDeclarationAndCall.kt"); } - @Test - public void constructorWithParameter() throws Exception { + public void testConstructorWithParameter() throws Exception { testFooBoxIsTrue("constructorWithParameter.kt"); } - @Test - public void constructorWithPropertiesAsParameters() throws Exception { + public void testConstructorWithPropertiesAsParameters() throws Exception { testFooBoxIsTrue("constructorWithPropertiesAsParameters.kt"); } - @Test - public void incrementProperty() throws Exception { + public void testIncrementProperty() throws Exception { testFunctionOutput("incrementProperty.kt", "foo", "box", "OK"); } - @Test - public void SimpleInitializer() throws Exception { + public void testSimpleInitializer() throws Exception { testFooBoxIsTrue("simpleInitializer.kt"); } - @Test - public void complexExpressionAsConstructorParameter() throws Exception { + public void testComplexExpressionAsConstructorParameter() throws Exception { testFooBoxIsTrue("complexExpressionAsConstructorParameter.kt"); } - @Test - public void propertyAccess() throws Exception { + public void testPropertyAccess() throws Exception { testFooBoxIsTrue("propertyAccess.kt"); } - @Test - public void propertiesAsParametersInitialized() throws Exception { + public void testPropertiesAsParametersInitialized() throws Exception { testFooBoxIsTrue("propertiesAsParametersInitialized.kt"); } - @Test - public void classWithoutNamespace() throws Exception { + public void testClassWithoutNamespace() throws Exception { testFunctionOutput("classWithoutNamespace.kt", "Anonymous", "box", true); } } diff --git a/translator/test/org/jetbrains/k2js/test/ClassInheritanceTest.java b/translator/test/org/jetbrains/k2js/test/ClassInheritanceTest.java index 655dcd324d9..d2b4703e918 100644 --- a/translator/test/org/jetbrains/k2js/test/ClassInheritanceTest.java +++ b/translator/test/org/jetbrains/k2js/test/ClassInheritanceTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,38 +12,31 @@ public final class ClassInheritanceTest extends TranslationTest { return MAIN; } - @Test - public void initializersOfBasicClassExecute() throws Exception { + public void testInitializersOfBasicClassExecute() throws Exception { testFunctionOutput("initializersOfBasicClassExecute.kt", "foo", "box", 3); } - @Test - public void methodOverride() throws Exception { + public void testMethodOverride() throws Exception { testFooBoxIsTrue("methodOverride.kt"); } - @Test - public void initializationOrder() throws Exception { + public void testInitializationOrder() throws Exception { testFooBoxIsTrue("initializationOrder.kt"); } - @Test - public void complexInitializationOrder() throws Exception { + public void testComplexInitializationOrder() throws Exception { testFooBoxIsTrue("complexInitializationOrder.kt"); } - @Test - public void valuePassedToAncestorConstructor() throws Exception { + public void testValuePassedToAncestorConstructor() throws Exception { testFooBoxIsTrue("valuePassedToAncestorConstructor.kt"); } - @Test - public void baseClassDefinedAfterDerived() throws Exception { + public void testBaseClassDefinedAfterDerived() throws Exception { testFooBoxIsTrue("baseClassDefinedAfterDerived.kt"); } - @Test - public void definitionOrder() throws Exception { + public void testDefinitionOrder() throws Exception { testFooBoxIsTrue("definitionOrder.kt"); } } diff --git a/translator/test/org/jetbrains/k2js/test/ConditionalTest.java b/translator/test/org/jetbrains/k2js/test/ConditionalTest.java index a5434d74123..8a2d0d0ccba 100644 --- a/translator/test/org/jetbrains/k2js/test/ConditionalTest.java +++ b/translator/test/org/jetbrains/k2js/test/ConditionalTest.java @@ -1,6 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; import org.mozilla.javascript.JavaScriptException; /** @@ -15,23 +14,24 @@ public class ConditionalTest extends AbstractExpressionTest { return MAIN; } - @Test - public void ifElseAsExpression() throws Exception { + public void testIfElseAsExpression() throws Exception { testFooBoxIsTrue("ifElseAsExpression.kt"); } - @Test - public void ifElse() throws Exception { + public void testIfElse() throws Exception { testFunctionOutput("if.kt", "foo", "box", 5); } - @Test - public void ifElseIf() throws Exception { + public void testIfElseIf() throws Exception { testFunctionOutput("elseif.kt", "foo", "box", 5); } - @Test(expected = JavaScriptException.class) - public void ifElseAsExpressionWithThrow() throws Exception { - testFooBoxIsTrue("ifAsExpressionWithThrow.kt"); + public void testIfElseAsExpressionWithThrow() throws Exception { + try { + testFooBoxIsTrue("ifAsExpressionWithThrow.kt"); + fail(); + } catch (JavaScriptException e) { + + } } } diff --git a/translator/test/org/jetbrains/k2js/test/ExampleTest.java b/translator/test/org/jetbrains/k2js/test/ExampleTest.java deleted file mode 100644 index 841fd57d5c5..00000000000 --- a/translator/test/org/jetbrains/k2js/test/ExampleTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jetbrains.k2js.test; - -/** - * @author Pavel Talanov - */ -public final class ExampleTest extends TranslationTest { - - final private static String MAIN = "examples/"; - - @Override - protected String mainDirectory() { - return MAIN; - } - - public void runBoxTest(String filename) throws Exception { - testFunctionOutput(filename, "Anonymous", "box", "OK"); - } -} diff --git a/translator/test/org/jetbrains/k2js/test/ExampleTestSuite.java b/translator/test/org/jetbrains/k2js/test/ExampleTestSuite.java new file mode 100644 index 00000000000..7a7528448e8 --- /dev/null +++ b/translator/test/org/jetbrains/k2js/test/ExampleTestSuite.java @@ -0,0 +1,45 @@ +package org.jetbrains.k2js.test; + +import junit.framework.Test; +import org.jetbrains.annotations.NotNull; + +public final class ExampleTestSuite extends TranslationTest { + + + final private static String MAIN = "examples/"; + + @Override + protected String mainDirectory() { + return MAIN; + } + + public void runBoxTest(String filename) throws Exception { + testFunctionOutput(filename, "Anonymous", "box", "OK"); + } + + private String name; + + public ExampleTestSuite(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + public void runTest() throws Exception { + runBoxTest(getName()); + } + + public static Test suite() { + return TranslatorTestCaseBuilder.suiteForDirectory("translator", + "/testFiles/examples/cases/", true, new TranslatorTestCaseBuilder.NamedTestFactory() { + @NotNull + @Override + public Test createTest(@NotNull String dataPath, @NotNull String name) { + return (new ExampleTestSuite(name)); + } + }); + } +} diff --git a/translator/test/org/jetbrains/k2js/test/ExtensionFunctionTest.java b/translator/test/org/jetbrains/k2js/test/ExtensionFunctionTest.java index 7e17b28c870..8a648642791 100644 --- a/translator/test/org/jetbrains/k2js/test/ExtensionFunctionTest.java +++ b/translator/test/org/jetbrains/k2js/test/ExtensionFunctionTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -13,48 +11,39 @@ public final class ExtensionFunctionTest extends TranslationTest { return MAIN; } - @Test - public void intExtension() throws Exception { + public void testIntExtension() throws Exception { testFooBoxIsTrue("intExtension.kt"); } - @Test - public void extensionWithImplicitReceiver() throws Exception { + public void testExtensionWithImplicitReceiver() throws Exception { testFooBoxIsTrue("extensionWithImplicitReceiver.kt"); } - @Test - public void extensionFunctionOnExpression() throws Exception { + public void testExtensionFunctionOnExpression() throws Exception { testFooBoxIsTrue("extensionFunctionOnExpression.kt"); } - @Test - public void extensionUsedInsideClass() throws Exception { + public void testExtensionUsedInsideClass() throws Exception { testFooBoxIsTrue("extensionUsedInsideClass.kt"); } - @Test - public void virtualExtension() throws Exception { + public void testVirtualExtension() throws Exception { testFooBoxIsTrue("virtualExtension.kt"); } - @Test - public void virtualExtensionOverride() throws Exception { + public void testVirtualExtensionOverride() throws Exception { testFooBoxIsTrue("virtualExtensionOverride.kt"); } - @Test - public void extensionLiteralPassedToFunction() throws Exception { + public void testExtensionLiteralPassedToFunction() throws Exception { testFooBoxIsTrue("extensionLiteralPassedToFunction.kt"); } - @Test - public void extensionInsideFunctionLiteral() throws Exception { + public void testExtensionInsideFunctionLiteral() throws Exception { testFooBoxIsTrue("extensionInsideFunctionLiteral.kt"); } - @Test - public void genericExtension() throws Exception { + public void testGenericExtension() throws Exception { testFooBoxIsOk("generic.kt"); } } diff --git a/translator/test/org/jetbrains/k2js/test/ExtensionPropertyTest.java b/translator/test/org/jetbrains/k2js/test/ExtensionPropertyTest.java index f6b0490f74b..895096996cc 100644 --- a/translator/test/org/jetbrains/k2js/test/ExtensionPropertyTest.java +++ b/translator/test/org/jetbrains/k2js/test/ExtensionPropertyTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -13,18 +11,15 @@ public final class ExtensionPropertyTest extends TranslationTest { return MAIN; } - @Test - public void simplePropertyWithGetter() throws Exception { + public void testSimplePropertyWithGetter() throws Exception { testFooBoxIsTrue("simplePropertyWithGetter.kt"); } - @Test - public void propertyWithGetterAndSetter() throws Exception { + public void testPropertyWithGetterAndSetter() throws Exception { testFooBoxIsTrue("propertyWithGetterAndSetter.kt"); } - @Test - public void absExtension() throws Exception { + public void testAbsExtension() throws Exception { testFooBoxIsTrue("absExtension.kt"); } } diff --git a/translator/test/org/jetbrains/k2js/test/ForTest.java b/translator/test/org/jetbrains/k2js/test/ForTest.java index fd4f3f883fb..9e493498f3a 100644 --- a/translator/test/org/jetbrains/k2js/test/ForTest.java +++ b/translator/test/org/jetbrains/k2js/test/ForTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,13 +12,11 @@ public final class ForTest extends AbstractExpressionTest { return MAIN; } - @Test - public void forIteratesOverArray() throws Exception { + public void testForIteratesOverArray() throws Exception { testFooBoxIsTrue("forIteratesOverArray.kt"); } - @Test - public void forOnEmptyArray() throws Exception { + public void testForOnEmptyArray() throws Exception { testFooBoxIsTrue("forOnEmptyArray.kt"); } } \ No newline at end of file diff --git a/translator/test/org/jetbrains/k2js/test/FunctionTest.java b/translator/test/org/jetbrains/k2js/test/FunctionTest.java index e03f4cd3dcb..4981b251c5a 100644 --- a/translator/test/org/jetbrains/k2js/test/FunctionTest.java +++ b/translator/test/org/jetbrains/k2js/test/FunctionTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,83 +12,74 @@ public class FunctionTest extends AbstractExpressionTest { return MAIN; } - @Test - public void functionUsedBeforeDeclaration() throws Exception { + public void testFunctionUsedBeforeDeclaration() throws Exception { testFooBoxIsTrue("functionUsedBeforeDeclaration.kt"); } - @Test - public void functionWithTwoParametersCall() throws Exception { + public void testFunctionWithTwoParametersCall() throws Exception { testFooBoxIsTrue("functionWithTwoParametersCall.kt"); } - @Test - public void functionLiteral() throws Exception { + public void testFunctionLiteral() throws Exception { testFooBoxIsTrue("functionLiteral.kt"); } - @Test - public void adderClosure() throws Exception { + public void testAdderClosure() throws Exception { testFooBoxIsTrue("adderClosure.kt"); } - @Test - public void loopClosure() throws Exception { + public void testLoopClosure() throws Exception { testFooBoxIsTrue("loopClosure.kt"); } - @Test - public void functionLiteralAsParameter() throws Exception { + public void testFunctionLiteralAsParameter() throws Exception { testFooBoxIsTrue("functionLiteralAsParameter.kt"); } - @Test - public void closureWithParameter() throws Exception { + public void testClosureWithParameter() throws Exception { testFooBoxIsOk("closureWithParameter.kt"); } - @Test - public void closureWithParameterAndBoxing() throws Exception { + public void testClosureWithParameterAndBoxing() throws Exception { testFooBoxIsOk("closureWithParameterAndBoxing.jet"); } - @Test - public void enclosingThis() throws Exception { + public void testEnclosingThis() throws Exception { testFunctionOutput("enclosingThis.kt", "Anonymous", "box", "OK"); } - @Test - public void implicitItParameter() throws Exception { + + public void testImplicitItParameter() throws Exception { testFooBoxIsTrue("implicitItParameter.kt"); } - @Test - public void defaultParameters() throws Exception { + + public void testDefaultParameters() throws Exception { testFooBoxIsTrue("defaultParameters.kt"); } - @Test - public void functionLiteralAsLastParameter() throws Exception { + + public void testFunctionLiteralAsLastParameter() throws Exception { testFooBoxIsTrue("functionLiteralAsLastParameter.kt"); } - @Test - public void namedArguments() throws Exception { + + public void testNamedArguments() throws Exception { testFooBoxIsTrue("namedArguments.kt"); } - @Test - public void expressionAsFunction() throws Exception { + + public void testExpressionAsFunction() throws Exception { testFooBoxIsTrue("expressionAsFunction.kt"); } - @Test - public void vararg() throws Exception { + + public void testVararg() throws Exception { testFooBoxIsTrue("vararg.kt"); } - @Test - public void kt921() throws Exception { + + public void testkt921() throws Exception { try { checkOutput("KT-921.kt", ""); } catch (Throwable e) { diff --git a/translator/test/org/jetbrains/k2js/test/IntrinsicTest.java b/translator/test/org/jetbrains/k2js/test/IntrinsicTest.java index a0d58b91707..d8632916568 100644 --- a/translator/test/org/jetbrains/k2js/test/IntrinsicTest.java +++ b/translator/test/org/jetbrains/k2js/test/IntrinsicTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,13 +12,12 @@ public class IntrinsicTest extends AbstractExpressionTest { return MAIN; } - @Test - public void intrinsicPlusAssign() throws Exception { + public void testIntrinsicPlusAssign() throws Exception { testFooBoxIsTrue("plusAssign.kt"); } - @Test - public void minusAssignOnProperty() throws Exception { + + public void testMinusAssignOnProperty() throws Exception { testFooBoxIsTrue("minusAssignOnProperty.kt"); } diff --git a/translator/test/org/jetbrains/k2js/test/JavaClassesTest.java b/translator/test/org/jetbrains/k2js/test/JavaClassesTest.java index 219a064f614..8ca3317ed5e 100644 --- a/translator/test/org/jetbrains/k2js/test/JavaClassesTest.java +++ b/translator/test/org/jetbrains/k2js/test/JavaClassesTest.java @@ -3,6 +3,7 @@ package org.jetbrains.k2js.test; /** * @author Pavel Talanov */ +@SuppressWarnings("FieldCanBeLocal") public abstract class JavaClassesTest extends TranslationTest { private final String SUITE = "java/"; diff --git a/translator/test/org/jetbrains/k2js/test/JavascriptTest.java b/translator/test/org/jetbrains/k2js/test/JavascriptTest.java deleted file mode 100644 index f1b990ce2ff..00000000000 --- a/translator/test/org/jetbrains/k2js/test/JavascriptTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.jetbrains.k2js.test; - -/** - * @author Pavel Talanov - */ -public final class JavascriptTest extends TranslationTest { - - final private static String MAIN = "javascript/"; - - @Override - protected String mainDirectory() { - return MAIN; - } - -} diff --git a/translator/test/org/jetbrains/k2js/test/KotlinLibTest.java b/translator/test/org/jetbrains/k2js/test/KotlinLibTest.java index 2497bd5d1b4..06fd40269dd 100644 --- a/translator/test/org/jetbrains/k2js/test/KotlinLibTest.java +++ b/translator/test/org/jetbrains/k2js/test/KotlinLibTest.java @@ -1,6 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; import org.mozilla.javascript.Context; import org.mozilla.javascript.Scriptable; @@ -11,7 +10,7 @@ import java.util.Map; /** * @author Pavel Talanov */ -public class KotlinLibTest extends TranslationTest { +public final class KotlinLibTest extends TranslationTest { final private static String MAIN = "kotlinLib/"; @@ -25,8 +24,8 @@ public class KotlinLibTest extends TranslationTest { runRhinoTest(Arrays.asList(kotlinLibraryPath()), new RhinoPropertyTypesChecker(objectName, propertyToType)); } - @Test - public void kotlinJsLibRunsWithRhino() throws Exception { + + public void testKotlinJsLibRunsWithRhino() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath()), new RhinoResultChecker() { @Override public void runChecks(Context context, Scriptable scope) throws Exception { @@ -36,18 +35,15 @@ public class KotlinLibTest extends TranslationTest { } //TODO: refactor - - - @Test - public void createdTraitIsJSObject() throws Exception { + public void testCreatedTraitIsJSObject() throws Exception { final Map> propertyToType = new HashMap>(); runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("trait.js")), new RhinoPropertyTypesChecker("foo", propertyToType)); } - @Test - public void createdNamespaceIsJSObject() throws Exception { + + public void testCreatedNamespaceIsJSObject() throws Exception { final Map> propertyToType = new HashMap>(); runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("namespace.js")), @@ -56,51 +52,49 @@ public class KotlinLibTest extends TranslationTest { // // TODO:Refactor calls to function result checker with test - @Test - public void namespaceHasDeclaredFunction() throws Exception { + public void testNamespaceHasDeclaredFunction() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("namespace.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void namespaceHasDeclaredClasses() throws Exception { + public void testNamespaceHasDeclaredClasses() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("namespaceWithClasses.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void isSameType() throws Exception { + + public void testIsSameType() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("isSameType.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void isAncestorType() throws Exception { + + public void testIsAncestorType() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("isAncestorType.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void isComplexTest() throws Exception { + + public void testIsComplexTest() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("isComplexTest.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void commaExpression() throws Exception { + + public void testCommaExpression() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("commaExpression.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void array() throws Exception { + + public void testArray() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("array.js")), new RhinoFunctionResultChecker("test", true)); } - @Test - public void hashMap() throws Exception { + + public void testHashMap() throws Exception { runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("hashMap.js")), new RhinoFunctionResultChecker("test", true)); } diff --git a/translator/test/org/jetbrains/k2js/test/MiscTest.java b/translator/test/org/jetbrains/k2js/test/MiscTest.java index 76cb44b4554..45df222b32d 100644 --- a/translator/test/org/jetbrains/k2js/test/MiscTest.java +++ b/translator/test/org/jetbrains/k2js/test/MiscTest.java @@ -1,14 +1,12 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov *

* This class contains tests that do not fall in any particular category * most probably because that functionality has very little support */ -public class MiscTest extends AbstractExpressionTest { +public final class MiscTest extends AbstractExpressionTest { final private static String MAIN = "misc/"; @Override @@ -16,25 +14,17 @@ public class MiscTest extends AbstractExpressionTest { return MAIN; } - @Test - public void namespaceProperties() throws Exception { + public void testNamespaceProperties() throws Exception { testFunctionOutput("localProperty.jet", "foo", "box", 50); } - @Test - public void intRange() throws Exception { + public void testIntRange() throws Exception { // checkOutput("intRange.kt", " "); testFooBoxIsTrue("intRange.kt"); } - @Test - public void safecallComputesExpressionOnlyOnce() throws Exception { + + public void testSafecallComputesExpressionOnlyOnce() throws Exception { testFooBoxIsTrue("safecallComputesExpressionOnlyOnce.kt"); } - - //TODO: -// @Test -// public void jquery() throws Exception { -// testFooBoxIsTrue("jquery.kt"); -// } } diff --git a/translator/test/org/jetbrains/k2js/test/MultiFileTest.java b/translator/test/org/jetbrains/k2js/test/MultiFileTest.java index 82453dc0a37..9d7aaf46394 100644 --- a/translator/test/org/jetbrains/k2js/test/MultiFileTest.java +++ b/translator/test/org/jetbrains/k2js/test/MultiFileTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,13 +12,11 @@ public final class MultiFileTest extends TranslationTest { return MAIN; } - @Test - public void functionsVisibleFromOtherFile() throws Exception { + public void testFunctionsVisibleFromOtherFile() throws Exception { testFooBoxIsTrue("functionsVisibleFromOtherFile"); } - @Test - public void classesInheritedFromOtherFile() throws Exception { + public void testClassesInheritedFromOtherFile() throws Exception { testFooBoxIsTrue("classesInheritedFromOtherFile"); } diff --git a/translator/test/org/jetbrains/k2js/test/NameClashesTest.java b/translator/test/org/jetbrains/k2js/test/NameClashesTest.java index fc466ffa0f1..d25739a78ae 100644 --- a/translator/test/org/jetbrains/k2js/test/NameClashesTest.java +++ b/translator/test/org/jetbrains/k2js/test/NameClashesTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,8 +12,7 @@ public final class NameClashesTest extends TranslationTest { return MAIN; } - @Test - public void methodOverload() throws Exception { + public void testMethodOverload() throws Exception { testFooBoxIsTrue("methodOverload.kt"); } } \ No newline at end of file diff --git a/translator/test/org/jetbrains/k2js/test/ObjectTest.java b/translator/test/org/jetbrains/k2js/test/ObjectTest.java index 5377930e737..d37afcf9222 100644 --- a/translator/test/org/jetbrains/k2js/test/ObjectTest.java +++ b/translator/test/org/jetbrains/k2js/test/ObjectTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,18 +12,18 @@ public final class ObjectTest extends TranslationTest { return MAIN; } - @Test - public void objectWithMethods() throws Exception { + + public void testObjectWithMethods() throws Exception { testFooBoxIsTrue("objectWithMethods.kt"); } - @Test - public void objectDeclaration() throws Exception { + + public void testObjectDeclaration() throws Exception { testFooBoxIsTrue("objectDeclaration.kt"); } - @Test - public void objectInMethod() throws Exception { + + public void testObjectInMethod() throws Exception { testFooBoxIsTrue("objectInMethod.kt"); } } \ No newline at end of file diff --git a/translator/test/org/jetbrains/k2js/test/OperationTest.java b/translator/test/org/jetbrains/k2js/test/OperationTest.java index af8225b1a0f..444b7527f6d 100644 --- a/translator/test/org/jetbrains/k2js/test/OperationTest.java +++ b/translator/test/org/jetbrains/k2js/test/OperationTest.java @@ -1,11 +1,9 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ -public class OperationTest extends AbstractExpressionTest { +public final class OperationTest extends AbstractExpressionTest { final private static String MAIN = "operation/"; @Override @@ -13,33 +11,34 @@ public class OperationTest extends AbstractExpressionTest { return MAIN; } - @Test - public void prefixIntOperations() throws Exception { + + public void testPrefixIntOperations() throws Exception { testFooBoxIsTrue("prefixIntOperations.kt"); } - @Test - public void postfixIntOperations() throws Exception { + + public void testPostfixIntOperations() throws Exception { testFooBoxIsTrue("postfixIntOperations.kt"); } - @Test - public void notBoolean() throws Exception { + + public void testNotBoolean() throws Exception { testFooBoxIsTrue("notBoolean.kt"); } - @Test - public void positiveAndNegativeNumbers() throws Exception { + + public void testPositiveAndNegativeNumbers() throws Exception { testFooBoxIsTrue("positiveAndNegativeNumbers.kt"); } - @Test - public void assign() throws Exception { + + public void testAssign() throws Exception { testFunctionOutput("assign.kt", "foo", "f", 2.0); } - @Test - public void comparison() throws Exception { + + public void testComparison() throws Exception { testFooBoxIsTrue("comparison.kt"); } } + diff --git a/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java b/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java index 816a0686895..b12b3c36f8d 100644 --- a/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java +++ b/translator/test/org/jetbrains/k2js/test/OperatorOverloadingTest.java @@ -1,11 +1,9 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ -public class OperatorOverloadingTest extends TranslationTest { +public final class OperatorOverloadingTest extends TranslationTest { final private static String MAIN = "operatorOverloading/"; @@ -14,89 +12,87 @@ public class OperatorOverloadingTest extends TranslationTest { return MAIN; } - @Test - public void plusOverload() throws Exception { + + public void testPlusOverload() throws Exception { testFooBoxIsTrue("plusOverload.kt"); } - @Test - public void postfixInc() throws Exception { + + public void testPostfixInc() throws Exception { testFooBoxIsTrue("postfixIncOverload.kt"); } - @Test - public void prefixInc() throws Exception { + + public void testPrefixInc() throws Exception { testFooBoxIsTrue("prefixDecOverload.kt"); } - @Test - public void prefixIncReturnsCorrectValue() throws Exception { + + public void testPrefixIncReturnsCorrectValue() throws Exception { testFooBoxIsTrue("prefixIncReturnsCorrectValue.kt"); } - @Test - public void overloadedCallOnProperty() throws Exception { + + public void testOverloadedCallOnProperty() throws Exception { testFooBoxIsTrue("overloadedCallOnProperty.kt"); } - @Test - public void postfixOnProperty() throws Exception { + + public void testPostfixOnProperty() throws Exception { testFooBoxIsTrue("postfixOnProperty.kt"); } - @Test - public void operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce() throws Exception { + + public void testOperatorOverloadOnPropertyCallGetterAndSetterOnlyOnce() throws Exception { testFooBoxIsTrue("operatorOverloadOnPropertyCallGetterAndSetterOnlyOnce.kt"); } - @Test - public void unaryOnIntProperty() throws Exception { + + public void testUnaryOnIntProperty() throws Exception { testFooBoxIsTrue("unaryOnIntProperty.kt"); } - @Test - public void unaryOnIntPropertyAsStatement() throws Exception { + + public void testUnaryOnIntPropertyAsStatement() throws Exception { testFooBoxIsTrue("unaryOnIntProperty2.kt"); } - @Test - public void binaryDivOverload() throws Exception { + + public void testBinaryDivOverload() throws Exception { testFooBoxIsTrue("binaryDivOverload.kt"); } - @Test - public void plusAssignNoReassign() throws Exception { + + public void testPlusAssignNoReassign() throws Exception { testFooBoxIsTrue("plusAssignNoReassign.kt"); } - @Test - public void plusAssignReassign() throws Exception { + + public void testPlusAssignReassign() throws Exception { testFooBoxIsTrue("plusAssignReassign.kt"); } - @Test - public void notOverload() throws Exception { + + public void testNotOverload() throws Exception { testFooBoxIsTrue("notOverload.kt"); } - @Test - public void compareTo() throws Exception { + + public void testCompareTo() throws Exception { testFooBoxIsTrue("compareTo.kt"); } - @Test - public void plusAndMinusAsAnExpression() throws Exception { + + public void testPlusAndMinusAsAnExpression() throws Exception { testFooBoxIsTrue("plusAndMinusAsAnExpression.kt"); } - @Test - public void usingModInCaseModAssignNotAvailable() throws Exception { + + public void testUsingModInCaseModAssignNotAvailable() throws Exception { testFooBoxIsTrue("usingModInCaseModAssignNotAvailable.kt"); } - - @Test - public void overloadPlusAssignArrayList() throws Exception { + public void testOverloadPlusAssignArrayList() throws Exception { testFooBoxIsOk("overloadPlusAssignArrayList.kt"); } } diff --git a/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java b/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java index 94a90c86f93..ac06743e405 100644 --- a/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java +++ b/translator/test/org/jetbrains/k2js/test/PatternMatchingTest.java @@ -1,6 +1,6 @@ package org.jetbrains.k2js.test; -import org.junit.Test; +import org.mozilla.javascript.JavaScriptException; /** * @author Pavel Talanov @@ -14,58 +14,61 @@ public final class PatternMatchingTest extends TranslationTest { return MAIN; } - @Test - public void whenType() throws Exception { + + public void testWhenType() throws Exception { testFooBoxIsTrue("whenType.kt"); } - @Test - public void whenNotType() throws Exception { + + public void testWhenNotType() throws Exception { testFooBoxIsTrue("whenNotType.kt"); } - @Test - public void whenExecutesOnlyOnce() throws Exception { + + public void testWhenExecutesOnlyOnce() throws Exception { testFooBoxIsTrue("whenExecutesOnlyOnce.kt"); } - @Test - public void whenValue() throws Exception { + + public void testWhenValue() throws Exception { testFooBoxIsTrue("whenValue.kt"); } - @Test - public void whenNotValue() throws Exception { + + public void testWhenNotValue() throws Exception { testFooBoxIsTrue("whenNotValue.kt"); } - @Test - public void whenValueOrType() throws Exception { + + public void testWhenValueOrType() throws Exception { testFooBoxIsTrue("whenValueOrType.kt"); } - @Test - public void whenWithIf() throws Exception { + + public void testWhenWithIf() throws Exception { testFooBoxIsTrue("whenWithIf.kt"); } - @Test - public void multipleCases() throws Exception { + + public void testMultipleCases() throws Exception { testFunctionOutput("multipleCases.kt", "foo", "box", 2.0); } - @Test - public void matchNullableType() throws Exception { + + public void testMatchNullableType() throws Exception { testFooBoxIsTrue("matchNullableType.kt"); } - @Test - public void whenAsExpression() throws Exception { + + public void testWhenAsExpression() throws Exception { testFooBoxIsTrue("whenAsExpression.kt"); } - @Test(expected = org.mozilla.javascript.JavaScriptException.class) public void whenAsExpressionWithThrow() throws Exception { - testFooBoxIsTrue("whenAsExpressionWithThrow.kt"); + try { + testFooBoxIsTrue("whenAsExpressionWithThrow.kt"); + fail(); + } catch (JavaScriptException e) { + } } -} +} \ No newline at end of file diff --git a/translator/test/org/jetbrains/k2js/test/PropertyAccessTest.java b/translator/test/org/jetbrains/k2js/test/PropertyAccessTest.java index e95e348d27d..5543eec6512 100644 --- a/translator/test/org/jetbrains/k2js/test/PropertyAccessTest.java +++ b/translator/test/org/jetbrains/k2js/test/PropertyAccessTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,59 +12,56 @@ public final class PropertyAccessTest extends TranslationTest { return MAIN; } - @Test - public void accessToInstanceProperty() throws Exception { + + public void testAccessToInstanceProperty() throws Exception { testFooBoxIsTrue("accessToInstanceProperty.kt"); } - @Test - public void twoClassesWithProperties() throws Exception { + + public void testTwoClassesWithProperties() throws Exception { testFooBoxIsTrue("twoClassesWithProperties.kt"); } - @Test - public void setter() throws Exception { + + public void testSetter() throws Exception { testFunctionOutput("setter.kt", "foo", "f", 99.0); } - @Test - public void customGetter() throws Exception { + + public void testCustomGetter() throws Exception { testFooBoxIsTrue("customGetter.kt"); } - @Test - public void customSetter() throws Exception { + + public void testCustomSetter() throws Exception { testFooBoxIsTrue("customSetter.kt"); } - @Test - public void safeCall() throws Exception { + + public void testSafeCall() throws Exception { testFooBoxIsTrue("safeCall.kt"); } - @Test - public void safeCallReturnsNullIfFails() throws Exception { + + public void testSafeCallReturnsNullIfFails() throws Exception { testFooBoxIsTrue("safeCallReturnsNullIfFails.kt"); } - @Test - public void namespacePropertyInitializer() throws Exception { + + public void testNamespacePropertyInitializer() throws Exception { testFooBoxIsTrue("namespacePropertyInitializer.kt"); } - @Test - public void namespacePropertySet() throws Exception { + + public void testNamespacePropertySet() throws Exception { testFooBoxIsTrue("namespacePropertySet.kt"); } - //TODO test - @Test - public void namespaceCustomAccessors() throws Exception { + public void testNamespaceCustomAccessors() throws Exception { testFooBoxIsTrue("namespaceCustomAccessors.kt"); } - @Test public void classUsesNamespaceProperties() throws Exception { testFooBoxIsTrue("classUsesNamespaceProperties.kt"); } diff --git a/translator/test/org/jetbrains/k2js/test/RTTITest.java b/translator/test/org/jetbrains/k2js/test/RTTITest.java index 3d76dfb2592..4a4de59c124 100644 --- a/translator/test/org/jetbrains/k2js/test/RTTITest.java +++ b/translator/test/org/jetbrains/k2js/test/RTTITest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,13 +12,11 @@ public class RTTITest extends TranslationTest { return MAIN; } - @Test - public void isSameClass() throws Exception { + public void testIsSameClass() throws Exception { testFooBoxIsTrue("isSameClass.kt"); } - @Test - public void notIsOtherClass() throws Exception { + public void testNotIsOtherClass() throws Exception { testFooBoxIsTrue("notIsOtherClass.kt"); } } diff --git a/translator/test/org/jetbrains/k2js/test/RangeTest.java b/translator/test/org/jetbrains/k2js/test/RangeTest.java index 6885f159bb4..24351c047a9 100644 --- a/translator/test/org/jetbrains/k2js/test/RangeTest.java +++ b/translator/test/org/jetbrains/k2js/test/RangeTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,20 +12,19 @@ public final class RangeTest extends TranslationTest { return MAIN; } - @Test - public void explicitRange() throws Exception { + + public void testExplicitRange() throws Exception { testFooBoxIsTrue("explicitRange.kt"); } - @Test - public void rangeSugarSyntax() throws Exception { + + public void testRangeSugarSyntax() throws Exception { testFooBoxIsTrue("rangeSugarSyntax.kt"); } - @Test - public void intInRange() throws Exception { + + public void testIntInRange() throws Exception { testFooBoxIsTrue("intInRange.kt"); } - } diff --git a/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java b/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java index e5ba453bdbc..f74832ce31a 100644 --- a/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java +++ b/translator/test/org/jetbrains/k2js/test/StandardClassesTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -13,40 +11,40 @@ public class StandardClassesTest extends TranslationTest { return MAIN; } - @Test - public void array() throws Exception { + + public void testArray() throws Exception { testFooBoxIsTrue("array.kt"); } - @Test - public void arrayAccess() throws Exception { + + public void testArrayAccess() throws Exception { testFooBoxIsTrue("arrayAccess.kt"); } - @Test - public void arrayIsFilledWithNulls() throws Exception { + + public void testArrayIsFilledWithNulls() throws Exception { testFooBoxIsTrue("arrayIsFilledWithNulls.kt"); } - @Test - public void arrayFunctionConstructor() throws Exception { + + public void testArrayFunctionConstructor() throws Exception { testFooBoxIsTrue("arrayFunctionConstructor.kt"); } - @Test - public void arraySize() throws Exception { + + public void testArraySize() throws Exception { testFooBoxIsTrue("arraySize.kt"); } //TODO: this feature in not supported for some time - //TODO: support it. Probably confugurable. -// @Test(expected = JavaScriptException.class) + //TODO: support it. Probably configurable. +// (expected = JavaScriptException.class) // public void arrayThrowsExceptionOnOOBaccess() throws Exception { // testFooBoxIsTrue("arrayThrowsExceptionOnOOBaccess.kt"); // } - @Test - public void arraysIterator() throws Exception { + + public void testArraysIterator() throws Exception { testFooBoxIsTrue("arraysIterator.kt"); } } diff --git a/translator/test/org/jetbrains/k2js/test/StdlibTest.java b/translator/test/org/jetbrains/k2js/test/StdlibTest.java deleted file mode 100644 index 18deb7d29ce..00000000000 --- a/translator/test/org/jetbrains/k2js/test/StdlibTest.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.jetbrains.k2js.test; - -/** - * @author Pavel Talanov - */ -public final class StdlibTest extends TranslationTest { - final private static String MAIN = "stdlib/"; - - @Override - protected String mainDirectory() { - return MAIN; - } - - //TODO: cant do due to big java dependencies -// @Test -// public void filter() throws Exception { -// testFooBoxIsTrue("Filter.kt"); -// } -} diff --git a/translator/test/org/jetbrains/k2js/test/StringTest.java b/translator/test/org/jetbrains/k2js/test/StringTest.java index 9a701a3e372..dfc1a8fbe71 100644 --- a/translator/test/org/jetbrains/k2js/test/StringTest.java +++ b/translator/test/org/jetbrains/k2js/test/StringTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,28 +12,28 @@ public class StringTest extends AbstractExpressionTest { return MAIN; } - @Test - public void stringConstant() throws Exception { + + public void testStringConstant() throws Exception { testFooBoxIsTrue("stringConstant.kt"); } - @Test - public void stringAssignment() throws Exception { + + public void testStringAssignment() throws Exception { testFooBoxIsTrue("stringAssignment.kt"); } - @Test - public void intInTemplate() throws Exception { + + public void testIntInTemplate() throws Exception { testFunctionOutput("intInTemplate.kt", "foo", "box", "my age is 3"); } - @Test - public void stringInTemplate() throws Exception { + + public void testStringInTemplate() throws Exception { testFunctionOutput("stringInTemplate.kt", "foo", "box", "oHelloo"); } - @Test - public void multipleExpressionInTemplate() throws Exception { + + public void testMultipleExpressionInTemplate() throws Exception { testFunctionOutput("multipleExpressionsInTemplate.kt", "foo", "box", "left = 3\nright = 2\nsum = 5\n"); } } diff --git a/translator/test/org/jetbrains/k2js/test/TraitTest.java b/translator/test/org/jetbrains/k2js/test/TraitTest.java index f09bb86027f..aebf711167f 100644 --- a/translator/test/org/jetbrains/k2js/test/TraitTest.java +++ b/translator/test/org/jetbrains/k2js/test/TraitTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,45 +12,43 @@ public final class TraitTest extends TranslationTest { return MAIN; } - @Test - public void traitAddsFunctionsToClass() throws Exception { + + public void testTraitAddsFunctionsToClass() throws Exception { testFooBoxIsTrue("traitAddsFunctionsToClass.kt"); } - @Test - public void classDerivesFromClassAndTrait() throws Exception { + + public void testClassDerivesFromClassAndTrait() throws Exception { testFooBoxIsTrue("classDerivesFromClassAndTrait.kt"); } - @Test - public void classDerivesFromTraitAndClass() throws Exception { + + public void testClassDerivesFromTraitAndClass() throws Exception { testFooBoxIsTrue("classDerivesFromTraitAndClass.kt"); } - @Test - public void example() throws Exception { + + public void testExample() throws Exception { testFooBoxIsTrue("example.kt"); } - @Test - public void traitExtendsTrait() throws Exception { + + public void testTraitExtendsTrait() throws Exception { testFooBoxIsTrue("traitExtendsTrait.kt"); } - @Test - public void traitExtendsTwoTraits() throws Exception { + + public void testTraitExtendsTwoTraits() throws Exception { testFooBoxIsTrue("traitExtendsTwoTraits.kt"); } - @Test - public void funDelegation() throws Exception { + + public void testFunDelegation() throws Exception { testFooBoxIsOk("funDelegation.jet"); } - @Test - public void definitionOrder() throws Exception { + + public void testDefinitionOrder() throws Exception { testFooBoxIsTrue("definitionOrder.kt"); } - - } diff --git a/translator/test/org/jetbrains/k2js/test/TranslationTest.java b/translator/test/org/jetbrains/k2js/test/TranslationTest.java index 0bacb37364e..20725fc3fa6 100644 --- a/translator/test/org/jetbrains/k2js/test/TranslationTest.java +++ b/translator/test/org/jetbrains/k2js/test/TranslationTest.java @@ -20,7 +20,7 @@ import java.util.List; /** * @author Pavel Talanov */ -public abstract class TranslationTest { +public abstract class TranslationTest extends BaseTest { private final static String TEST_FILES = "translator/testFiles/"; private static final String CASES = "cases/"; diff --git a/examples/test/JetTestCaseBuilder.java b/translator/test/org/jetbrains/k2js/test/TranslatorTestCaseBuilder.java similarity index 96% rename from examples/test/JetTestCaseBuilder.java rename to translator/test/org/jetbrains/k2js/test/TranslatorTestCaseBuilder.java index eb8b79857af..f10fc869a63 100644 --- a/examples/test/JetTestCaseBuilder.java +++ b/translator/test/org/jetbrains/k2js/test/TranslatorTestCaseBuilder.java @@ -1,3 +1,5 @@ +package org.jetbrains.k2js.test; + import junit.framework.Test; import junit.framework.TestSuite; import org.jetbrains.annotations.NotNull; @@ -10,9 +12,9 @@ import java.util.Collections; import java.util.List; /** - * @author abreslav + * @author PavelTalanov */ -public abstract class JetTestCaseBuilder { +public abstract class TranslatorTestCaseBuilder { public static FilenameFilter emptyFilter = new FilenameFilter() { @Override public boolean accept(File file, String name) { diff --git a/translator/test/org/jetbrains/k2js/test/TupleTest.java b/translator/test/org/jetbrains/k2js/test/TupleTest.java index 7442e097e62..8e052824783 100644 --- a/translator/test/org/jetbrains/k2js/test/TupleTest.java +++ b/translator/test/org/jetbrains/k2js/test/TupleTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,13 +12,11 @@ public final class TupleTest extends TranslationTest { return MAIN; } - @Test - public void twoElements() throws Exception { + public void testTwoElements() throws Exception { testFooBoxIsTrue("twoElements.kt"); } - @Test - public void multipleMembers() throws Exception { + public void testMultipleMembers() throws Exception { testFooBoxIsTrue("multipleMembers.kt"); } diff --git a/translator/test/org/jetbrains/k2js/test/WebDemoExamples1Test.java b/translator/test/org/jetbrains/k2js/test/WebDemoExamples1Test.java index a4162231c21..82625e45f26 100644 --- a/translator/test/org/jetbrains/k2js/test/WebDemoExamples1Test.java +++ b/translator/test/org/jetbrains/k2js/test/WebDemoExamples1Test.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,39 +12,39 @@ public final class WebDemoExamples1Test extends TranslationTest { return MAIN; } - @Test - public void printArg() throws Exception { + + public void testPrintArg() throws Exception { checkOutput("printArg.kt", "Hello, world!", "Hello, world!"); } - @Test - public void whileLoop() throws Exception { + + public void testWhileLoop() throws Exception { checkOutput("whileLoop.kt", "guest1\nguest2\nguest3\nguest4\n", "guest1", "guest2", "guest3", "guest4"); } - @Test - public void ifAsExpression() throws Exception { + + public void testIfAsExpression() throws Exception { checkOutput("ifAsExpression.kt", "20\n", "10", "20"); } - @Test - public void objectOrientedHello() throws Exception { + + public void testObjectOrientedHello() throws Exception { checkOutput("objectOrientedHello.kt", "Hello, Pavel!\n", "Pavel"); } - @Test - public void multiLanguageHello() throws Exception { + + public void testMultiLanguageHello() throws Exception { checkOutput("multiLanguageHello.kt", "Salut!\n", "FR"); } - @Test - public void nullChecks() throws Exception { + + public void testNullChecks() throws Exception { checkOutput("nullChecks.kt", "No number supplied"); checkOutput("nullChecks.kt", "6", "2", "3"); } - @Test - public void ranges() throws Exception { + + public void testRanges() throws Exception { checkOutput("ranges.kt", "OK\n" + " 1 2 3 4 5\n" + "Out: array has only 3 elements. x = 4\n" + @@ -59,8 +57,8 @@ public final class WebDemoExamples1Test extends TranslationTest { "No: array doesn't contains ddd\n", "10"); } - @Test - public void forLoop() throws Exception { + + public void testForLoop() throws Exception { checkOutput("forLoop.kt", "a\n" + "b\n" + "c\n" + @@ -71,18 +69,16 @@ public final class WebDemoExamples1Test extends TranslationTest { checkOutput("forLoop.kt", "123\n\n123\n", "123"); } - @Test - public void isCheck() throws Exception { + + public void testIsCheck() throws Exception { checkOutput("isCheck.kt", "3\nnull\n"); } - @Test - public void patternMatching() throws Exception { + + public void testPatternMatching() throws Exception { checkOutput("patternMatching.kt", "Greeting\n" + "One\n" + "Not a string\n" + "Unknown\n"); } - - } diff --git a/translator/test/org/jetbrains/k2js/test/WebDemoExamples2Test.java b/translator/test/org/jetbrains/k2js/test/WebDemoExamples2Test.java index a57ad663d26..18c36af77dc 100644 --- a/translator/test/org/jetbrains/k2js/test/WebDemoExamples2Test.java +++ b/translator/test/org/jetbrains/k2js/test/WebDemoExamples2Test.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -14,20 +12,16 @@ public final class WebDemoExamples2Test extends TranslationTest { return MAIN; } - @Test - public void bottles() throws Exception { + public void testBottles() throws Exception { testWithMain("bottles", "2", "2"); testWithMain("bottles", ""); } - //TODO: a couple of classes not supported and objects - @Test - public void life() throws Exception { + public void testLife() throws Exception { testWithMain("life", "", "2"); } - @Test - public void builder() throws Exception { + public void testBuilder() throws Exception { testWithMain("builder", ""); testWithMain("builder", "1", "over9000"); } diff --git a/translator/test/org/jetbrains/k2js/test/WhileTest.java b/translator/test/org/jetbrains/k2js/test/WhileTest.java index 94d0d1093ad..3572c5d2dd9 100644 --- a/translator/test/org/jetbrains/k2js/test/WhileTest.java +++ b/translator/test/org/jetbrains/k2js/test/WhileTest.java @@ -1,7 +1,5 @@ package org.jetbrains.k2js.test; -import org.junit.Test; - /** * @author Pavel Talanov */ @@ -13,43 +11,38 @@ public final class WhileTest extends AbstractExpressionTest { return MAIN; } - @Test - public void whileSimpleTest() throws Exception { + public void testWhileSimpleTest() throws Exception { testFooBoxIsTrue("while.kt"); } - @Test - public void doWhileSimpleTest() throws Exception { + public void testDoWhileSimpleTest() throws Exception { testFooBoxIsTrue("doWhile.kt"); } - @Test - public void doWhileExecutesAtLeastOnce() throws Exception { + public void testDoWhileExecutesAtLeastOnce() throws Exception { testFooBoxIsTrue("doWhile2.kt"); } - @Test - public void whileDoesntExecuteEvenOnceIfConditionIsFalse() throws Exception { + public void testWhileDoesntExecuteEvenOnceIfConditionIsFalse() throws Exception { testFooBoxIsTrue("while2.kt"); } - @Test - public void breakWhile() throws Exception { + public void testBreakWhile() throws Exception { testFooBoxIsTrue("breakWhile.kt"); } - @Test - public void breakDoWhile() throws Exception { + + public void testBreakDoWhile() throws Exception { testFooBoxIsTrue("breakDoWhile.kt"); } - @Test - public void continueWhile() throws Exception { + + public void testContinueWhile() throws Exception { testFooBoxIsTrue("continueWhile.kt"); } - @Test - public void continueDoWhile() throws Exception { + + public void testContinueDoWhile() throws Exception { testFooBoxIsTrue("continueDoWhile.kt"); } } diff --git a/translator/translator.iml b/translator/translator.iml index c385b0d2598..a9835139ad8 100644 --- a/translator/translator.iml +++ b/translator/translator.iml @@ -23,10 +23,10 @@ - +