migrated to junit3
This commit is contained in:
Generated
-1
@@ -14,7 +14,6 @@
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/translator/lib/guava-10.0.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../Kotlin/jet/lib/asm-util-3.3.1.jar" path-in-jar="/" />
|
||||
<element id="module-output" name="idea_fix" />
|
||||
<element id="file-copy" path="E:/rt.jar" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
Generated
+1
-1
@@ -4,12 +4,12 @@
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/backend/backend.iml" filepath="$PROJECT_DIR$/../../Kotlin/jet/compiler/backend/backend.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/cli/cli.iml" filepath="$PROJECT_DIR$/../../Kotlin/jet/compiler/cli/cli.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/tests/compiler-tests.iml" filepath="$PROJECT_DIR$/../../Kotlin/jet/compiler/tests/compiler-tests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/frontend.iml" filepath="$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend/frontend.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../Kotlin/jet/compiler/frontend/frontend.iml" filepath="$PROJECT_DIR$/../Kotlin/jet/compiler/frontend/frontend.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend.java/frontend.java.iml" filepath="$PROJECT_DIR$/../../Kotlin/jet/compiler/frontend.java/frontend.java.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../Kotlin/jet/compiler/frontend.java/frontend.java.iml" filepath="$PROJECT_DIR$/../Kotlin/jet/compiler/frontend.java/frontend.java.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/idea_fix/idea_fix.iml" filepath="$PROJECT_DIR$/idea_fix/idea_fix.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/examples/jetTests.iml" filepath="$PROJECT_DIR$/examples/jetTests.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/js/js.iml" filepath="$PROJECT_DIR$/js/js.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jslib/jslib.iml" filepath="$PROJECT_DIR$/jslib/jslib.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../../Kotlin/jet/stdlib/stdlib.iml" filepath="$PROJECT_DIR$/../../Kotlin/jet/stdlib/stdlib.iml" />
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -147,6 +147,25 @@ public open class HashMap<erased K, erased V>() : java.util.Map<K, V> {
|
||||
override public fun values() : java.util.Collection<V> {}
|
||||
}
|
||||
|
||||
library
|
||||
public open class LinkedList<erased E>() : List<E> {
|
||||
override public fun iterator() : java.util.Iterator<E> {}
|
||||
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<out E>) : 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
|
||||
|
||||
Binary file not shown.
@@ -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<String>) {}", " a 3 1 2134", "");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void systemOutTest() throws Exception {
|
||||
public void testSystemOutTest() throws Exception {
|
||||
evaluateCodeWithParameters("class A() {} fun main(args : Array<String>) { var a = A();}", "", "");
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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/";
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<String, Class<? extends Scriptable>> propertyToType
|
||||
= new HashMap<String, Class<? extends Scriptable>>();
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("trait.js")),
|
||||
new RhinoPropertyTypesChecker("foo", propertyToType));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createdNamespaceIsJSObject() throws Exception {
|
||||
|
||||
public void testCreatedNamespaceIsJSObject() throws Exception {
|
||||
final Map<String, Class<? extends Scriptable>> propertyToType
|
||||
= new HashMap<String, Class<? extends Scriptable>>();
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
* <p/>
|
||||
* 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");
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
// }
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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/";
|
||||
|
||||
+4
-2
@@ -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) {
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="guava-10.0.1" level="application" />
|
||||
<orderEntry type="library" name="junit-4.10" level="application" />
|
||||
<orderEntry type="library" name="js" level="application" />
|
||||
<orderEntry type="library" name="idea-full" level="application" />
|
||||
<orderEntry type="module" module-name="js" />
|
||||
<orderEntry type="module" module-name="compiler-tests" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user