JS backend: fix tests after move testTrue and testFalse to common place

This commit is contained in:
Zalim Bashorov
2015-06-03 17:26:17 +03:00
parent 430a3c121d
commit 4f0a858e93
4 changed files with 15 additions and 23 deletions
@@ -16,12 +16,6 @@
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 StringTest() {
@@ -37,18 +31,15 @@ public final class StringTest extends AbstractExpressionTest {
}
public void testIntInTemplate() throws Exception {
fooBoxIsValue("my age is 3");
checkHasNoToStringCalls();
checkFooBoxIsOk();
}
public void testStringInTemplate() throws Exception {
fooBoxIsValue("oHelloo");
checkHasNoToStringCalls();
checkFooBoxIsOk();
}
public void testMultipleExpressionsInTemplate() throws Exception {
fooBoxIsValue("left = 3\nright = 2\nsum = 5\n");
checkHasNoToStringCalls();
checkFooBoxIsOk();
}
public void testObjectToStringCallInTemplate() throws Exception {
@@ -71,14 +62,6 @@ public final class StringTest extends AbstractExpressionTest {
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 {
checkFooBoxIsOk();
}
@@ -1,7 +1,10 @@
// CHECK_NOT_CALLED_IN_SCOPE: scope=box function=toString
package foo
fun box(): String {
var number = 3
return ("my age is $number");
assertEquals("my age is 3", "my age is $number")
return "OK"
}
@@ -1,8 +1,11 @@
// CHECK_NOT_CALLED_IN_SCOPE: scope=box function=toString
package foo
fun box(): String {
var right = 2
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
fun box(): String {
var name = "Hello"
return ("o${name}o");
assertEquals("oHelloo", "o${name}o")
return "OK";
}