JS backend: fix tests after move testTrue and testFalse to common place
This commit is contained in:
@@ -16,12 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.js.test.semantics;
|
package org.jetbrains.kotlin.js.test.semantics;
|
||||||
|
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
|
||||||
import org.jetbrains.kotlin.js.config.EcmaVersion;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public final class StringTest extends AbstractExpressionTest {
|
public final class StringTest extends AbstractExpressionTest {
|
||||||
|
|
||||||
public StringTest() {
|
public StringTest() {
|
||||||
@@ -37,18 +31,15 @@ public final class StringTest extends AbstractExpressionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testIntInTemplate() throws Exception {
|
public void testIntInTemplate() throws Exception {
|
||||||
fooBoxIsValue("my age is 3");
|
checkFooBoxIsOk();
|
||||||
checkHasNoToStringCalls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testStringInTemplate() throws Exception {
|
public void testStringInTemplate() throws Exception {
|
||||||
fooBoxIsValue("oHelloo");
|
checkFooBoxIsOk();
|
||||||
checkHasNoToStringCalls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMultipleExpressionsInTemplate() throws Exception {
|
public void testMultipleExpressionsInTemplate() throws Exception {
|
||||||
fooBoxIsValue("left = 3\nright = 2\nsum = 5\n");
|
checkFooBoxIsOk();
|
||||||
checkHasNoToStringCalls();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testObjectToStringCallInTemplate() throws Exception {
|
public void testObjectToStringCallInTemplate() throws Exception {
|
||||||
@@ -71,14 +62,6 @@ public final class StringTest extends AbstractExpressionTest {
|
|||||||
fooBoxIsValue("2354");
|
fooBoxIsValue("2354");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkHasNoToStringCalls() throws IOException {
|
|
||||||
for (EcmaVersion ecmaVersion : DEFAULT_ECMA_VERSIONS) {
|
|
||||||
String filePath = getOutputFilePath(getTestName(true), ecmaVersion);
|
|
||||||
String text = FileUtil.loadFile(new File(filePath), /*convertLineSeparators = */ true);
|
|
||||||
assertFalse(filePath + " should not contain toString calls", text.contains("toString"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testStringSplit() throws Exception {
|
public void testStringSplit() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
// CHECK_NOT_CALLED_IN_SCOPE: scope=box function=toString
|
||||||
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var number = 3
|
var number = 3
|
||||||
return ("my age is $number");
|
assertEquals("my age is 3", "my age is $number")
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -1,8 +1,11 @@
|
|||||||
|
// CHECK_NOT_CALLED_IN_SCOPE: scope=box function=toString
|
||||||
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var right = 2
|
var right = 2
|
||||||
var left = 3
|
var left = 3
|
||||||
return ("left = $left\nright = $right\nsum = ${left + right}\n");
|
assertEquals("left = 3\nright = 2\nsum = 5\n", "left = $left\nright = $right\nsum = ${left + right}\n");
|
||||||
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
|
// CHECK_NOT_CALLED_IN_SCOPE: scope=box function=toString
|
||||||
|
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var name = "Hello"
|
var name = "Hello"
|
||||||
return ("o${name}o");
|
assertEquals("oHelloo", "o${name}o")
|
||||||
|
return "OK";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user