reorganise test structure and remove a couple of old test classes
This commit is contained in:
@@ -3,6 +3,7 @@ package org.jetbrains.k2js.test;
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
//TODO: remove class
|
||||
public class BasicClassTest extends TranslationTest {
|
||||
|
||||
final private static String MAIN = "class/";
|
||||
@@ -12,43 +13,6 @@ public class BasicClassTest extends TranslationTest {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
|
||||
public void testClassInstantiation() throws Exception {
|
||||
testFooBoxIsTrue("classInstantiation.kt");
|
||||
}
|
||||
|
||||
public void testMethodDeclarationAndCall() throws Exception {
|
||||
testFooBoxIsTrue("methodDeclarationAndCall.kt");
|
||||
}
|
||||
|
||||
public void testConstructorWithParameter() throws Exception {
|
||||
testFooBoxIsTrue("constructorWithParameter.kt");
|
||||
}
|
||||
|
||||
public void testConstructorWithPropertiesAsParameters() throws Exception {
|
||||
testFooBoxIsTrue("constructorWithPropertiesAsParameters.kt");
|
||||
}
|
||||
|
||||
public void testIncrementProperty() throws Exception {
|
||||
testFunctionOutput("incrementProperty.kt", "foo", "box", "OK");
|
||||
}
|
||||
|
||||
public void testSimpleInitializer() throws Exception {
|
||||
testFooBoxIsTrue("simpleInitializer.kt");
|
||||
}
|
||||
|
||||
public void testComplexExpressionAsConstructorParameter() throws Exception {
|
||||
testFooBoxIsTrue("complexExpressionAsConstructorParameter.kt");
|
||||
}
|
||||
|
||||
public void testPropertyAccess() throws Exception {
|
||||
testFooBoxIsTrue("propertyAccess.kt");
|
||||
}
|
||||
|
||||
public void testPropertiesAsParametersInitialized() throws Exception {
|
||||
testFooBoxIsTrue("propertiesAsParametersInitialized.kt");
|
||||
}
|
||||
|
||||
public void testClassWithoutNamespace() throws Exception {
|
||||
testFunctionOutput("classWithoutNamespace.kt", "Anonymous", "box", true);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.mozilla.javascript.JavaScriptException;
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
//TODO: remove class
|
||||
public class ConditionalTest extends AbstractExpressionTest {
|
||||
|
||||
final private static String MAIN = "conditional/";
|
||||
@@ -14,18 +15,6 @@ public class ConditionalTest extends AbstractExpressionTest {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
public void testIfElseAsExpression() throws Exception {
|
||||
testFooBoxIsTrue("ifElseAsExpression.kt");
|
||||
}
|
||||
|
||||
public void testIfElse() throws Exception {
|
||||
testFunctionOutput("if.kt", "foo", "box", 5);
|
||||
}
|
||||
|
||||
public void testIfElseIf() throws Exception {
|
||||
testFunctionOutput("elseif.kt", "foo", "box", 5);
|
||||
}
|
||||
|
||||
public void testIfElseAsExpressionWithThrow() throws Exception {
|
||||
try {
|
||||
testFooBoxIsTrue("ifAsExpressionWithThrow.kt");
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public class IntrinsicTest extends AbstractExpressionTest {
|
||||
|
||||
final private static String MAIN = "intrinsic/";
|
||||
|
||||
@Override
|
||||
protected String mainDirectory() {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
public void testIntrinsicPlusAssign() throws Exception {
|
||||
testFooBoxIsTrue("plusAssign.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testMinusAssignOnProperty() throws Exception {
|
||||
testFooBoxIsTrue("minusAssignOnProperty.kt");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public final class OperationTest extends AbstractExpressionTest {
|
||||
final private static String MAIN = "operation/";
|
||||
|
||||
@Override
|
||||
protected String mainDirectory() {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
|
||||
public void testPrefixIntOperations() throws Exception {
|
||||
testFooBoxIsTrue("prefixIntOperations.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testPostfixIntOperations() throws Exception {
|
||||
testFooBoxIsTrue("postfixIntOperations.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testNotBoolean() throws Exception {
|
||||
testFooBoxIsTrue("notBoolean.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testPositiveAndNegativeNumbers() throws Exception {
|
||||
testFooBoxIsTrue("positiveAndNegativeNumbers.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testAssign() throws Exception {
|
||||
testFunctionOutput("assign.kt", "foo", "f", 2.0);
|
||||
}
|
||||
|
||||
|
||||
public void testComparison() throws Exception {
|
||||
testFooBoxIsTrue("comparison.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public final class SimpleTestSuite extends TranslationTest {
|
||||
final private static String MAIN = "simple/";
|
||||
|
||||
@Override
|
||||
protected String mainDirectory() {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
public void runBoxTest(String filename) throws Exception {
|
||||
testFooBoxIsTrue(filename);
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
public SimpleTestSuite(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/simple/cases/", true, new TranslatorTestCaseBuilder.NamedTestFactory() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Test createTest(@NotNull String dataPath, @NotNull String name) {
|
||||
return (new SimpleTestSuite(name));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public final class WhileTest extends AbstractExpressionTest {
|
||||
|
||||
private static final String MAIN = "while/";
|
||||
|
||||
protected String mainDirectory() {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
public void testWhileSimpleTest() throws Exception {
|
||||
testFooBoxIsTrue("while.kt");
|
||||
}
|
||||
|
||||
public void testDoWhileSimpleTest() throws Exception {
|
||||
testFooBoxIsTrue("doWhile.kt");
|
||||
}
|
||||
|
||||
public void testDoWhileExecutesAtLeastOnce() throws Exception {
|
||||
testFooBoxIsTrue("doWhile2.kt");
|
||||
}
|
||||
|
||||
public void testWhileDoesntExecuteEvenOnceIfConditionIsFalse() throws Exception {
|
||||
testFooBoxIsTrue("while2.kt");
|
||||
}
|
||||
|
||||
public void testBreakWhile() throws Exception {
|
||||
testFooBoxIsTrue("breakWhile.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testBreakDoWhile() throws Exception {
|
||||
testFooBoxIsTrue("breakDoWhile.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testContinueWhile() throws Exception {
|
||||
testFooBoxIsTrue("continueWhile.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testContinueDoWhile() throws Exception {
|
||||
testFooBoxIsTrue("continueDoWhile.kt");
|
||||
}
|
||||
}
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
package foo
|
||||
|
||||
class Slot() {
|
||||
var vitality: Int = 10000
|
||||
|
||||
+3
-1
@@ -4,4 +4,6 @@ fun f(): Int {
|
||||
var x: Int = 1
|
||||
x = x + 1
|
||||
return x
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = f() == 2
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
package foo
|
||||
|
||||
fun box() : Int {
|
||||
fun bor() : Int {
|
||||
val a = 2;
|
||||
val b = 3;
|
||||
var c = 4;
|
||||
@@ -14,3 +14,5 @@ fun box() : Int {
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = bor() == 5
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
package foo
|
||||
|
||||
fun box() : Int {
|
||||
fun bol() : Int {
|
||||
val a = 2;
|
||||
val b = 3;
|
||||
var c = 4;
|
||||
@@ -17,3 +17,5 @@ fun box() : Int {
|
||||
}
|
||||
}
|
||||
|
||||
fun box() = bol() == 5
|
||||
|
||||
Reference in New Issue
Block a user