Minor in JS backend tests: use checkFooBoxIsOk instead of fooBoxIsValue
This commit is contained in:
@@ -50,7 +50,7 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
|||||||
runFunctionOutputTestByPath(ecmaVersions, getInputFilePath(kotlinFilename), packageName, functionName, expectedResult);
|
runFunctionOutputTestByPath(ecmaVersions, getInputFilePath(kotlinFilename), packageName, functionName, expectedResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runFunctionOutputTestByPath(
|
private void runFunctionOutputTestByPath(
|
||||||
@NotNull Iterable<EcmaVersion> ecmaVersions,
|
@NotNull Iterable<EcmaVersion> ecmaVersions,
|
||||||
@NotNull String kotlinFilePath,
|
@NotNull String kotlinFilePath,
|
||||||
@NotNull String packageName,
|
@NotNull String packageName,
|
||||||
@@ -73,14 +73,6 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
|||||||
checkFooBoxIsTrue(getTestName(true) + ".kt", DEFAULT_ECMA_VERSIONS);
|
checkFooBoxIsTrue(getTestName(true) + ".kt", DEFAULT_ECMA_VERSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fooBoxIsValue(Object expected) throws Exception {
|
|
||||||
runFunctionOutputTest(DEFAULT_ECMA_VERSIONS, getTestName(true) + ".kt", TEST_PACKAGE, TEST_FUNCTION, expected);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void fooBoxTest(@NotNull Iterable<EcmaVersion> ecmaVersions) throws Exception {
|
|
||||||
checkFooBoxIsTrue(getTestName(true) + ".kt", ecmaVersions);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkFooBoxIsOk() throws Exception {
|
protected void checkFooBoxIsOk() throws Exception {
|
||||||
checkFooBoxIsOk(getTestName(true) + ".kt");
|
checkFooBoxIsOk(getTestName(true) + ".kt");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ public final class DollarParameterTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testDollarParameter() throws Exception {
|
public void testDollarParameter() throws Exception {
|
||||||
fooBoxIsValue("Hello world!");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public final class InvokeConventionTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testInvokeMethod() throws Exception {
|
public void testInvokeMethod() throws Exception {
|
||||||
fooBoxIsValue("hello world!");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExplicitInvokeLambda() throws Exception {
|
public void testExplicitInvokeLambda() throws Exception {
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public final class MiscTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testPackageLevelVarInPackage() throws Exception {
|
public void testPackageLevelVarInPackage() throws Exception {
|
||||||
fooBoxIsValue("OK");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testPackageLevelVarInRoot() throws Exception {
|
public void testPackageLevelVarInRoot() throws Exception {
|
||||||
@@ -161,7 +161,7 @@ public final class MiscTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testLocalVarAsFunction() throws Exception {
|
public void testLocalVarAsFunction() throws Exception {
|
||||||
fooBoxIsValue("OK");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testExclExclThrows() throws Exception {
|
public void testExclExclThrows() throws Exception {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public final class NumberTest extends SingleFileTranslationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testDivision() throws Exception {
|
public void testDivision() throws Exception {
|
||||||
fooBoxIsValue("SUCCESS");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
// KT-2342 Type mismatch on Int division (JavaScript back-end)
|
// KT-2342 Type mismatch on Int division (JavaScript back-end)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public final class PropertyAccessTest extends SingleFileTranslationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testSetter() throws Exception {
|
public void testSetter() throws Exception {
|
||||||
fooBoxIsValue(99.0);
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public final class StringTemplatesTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testObjectWithToString() throws Exception {
|
public void testObjectWithToString() throws Exception {
|
||||||
fooBoxIsValue("a = abcS, b = defS");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStringValues() throws Exception {
|
public void testStringValues() throws Exception {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public final class StringTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testNumbersInTemplate() throws Exception {
|
public void testNumbersInTemplate() throws Exception {
|
||||||
fooBoxIsValue("2354");
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStringSplit() throws Exception {
|
public void testStringSplit() throws Exception {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public final class WhenTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testMultipleCases() throws Exception {
|
public void testMultipleCases() throws Exception {
|
||||||
fooBoxIsValue(2.0);
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMatchNullableType() throws Exception {
|
public void testMatchNullableType() throws Exception {
|
||||||
|
|||||||
+3
-2
@@ -5,5 +5,6 @@ fun MyController(`$scope`: String): String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
return MyController("world")
|
assertEquals("Hello world!", MyController("world"))
|
||||||
}
|
return "OK"
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ class Foo(val postfix: String) {
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
val a = Foo(" world!")
|
val a = Foo(" world!")
|
||||||
return a("hello")
|
assertEquals("hello world!", a("hello"))
|
||||||
}
|
return "OK"
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ fun box(): String {
|
|||||||
val number = 3
|
val number = 3
|
||||||
val s1 = "${number - 1}${number}"
|
val s1 = "${number - 1}${number}"
|
||||||
val s2 = "${5}${4}"
|
val s2 = "${5}${4}"
|
||||||
return "${s1}${s2}"
|
assertEquals("2354", "${s1}${s2}")
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -10,5 +10,6 @@ fun box(): String {
|
|||||||
val a = Foo("abc")
|
val a = Foo("abc")
|
||||||
val b = Foo("def")
|
val b = Foo("def")
|
||||||
val message = "a = $a, b = $b"
|
val message = "a = $a, b = $b"
|
||||||
return message
|
assertEquals("a = abcS, b = defS", message)
|
||||||
}
|
return "OK"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package foo
|
package foo
|
||||||
|
|
||||||
fun box(): Int {
|
fun box(): String {
|
||||||
val c = 3
|
val c = 3
|
||||||
val d = 5
|
val d = 5
|
||||||
var z = 0
|
var z = 0
|
||||||
@@ -17,5 +17,6 @@ fun box(): Int {
|
|||||||
z = -1000;
|
z = -1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return z
|
assertEquals(2, z)
|
||||||
}
|
return "OK"
|
||||||
|
}
|
||||||
|
|||||||
+2
-2
@@ -40,5 +40,5 @@ fun box(): Any? {
|
|||||||
if ((f3 / f4 - 2.5.toFloat()) > 0.01) {
|
if ((f3 / f4 - 2.5.toFloat()) > 0.01) {
|
||||||
return "9"
|
return "9"
|
||||||
}
|
}
|
||||||
return "SUCCESS"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ class Test() {
|
|||||||
var a: Int = 1
|
var a: Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fun box(): Int {
|
fun box(): String {
|
||||||
var a = Test()
|
|
||||||
var b = Test()
|
var b = Test()
|
||||||
|
assertEquals(1, b.a)
|
||||||
b.a = 100
|
b.a = 100
|
||||||
return (b.a - a.a)
|
assertEquals(100, b.a)
|
||||||
}
|
return "OK"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user