JS test: removed legacy inline tests
This commit is contained in:
committed by
Zalim Bashorov
parent
0484df00c3
commit
1dcc096753
@@ -16,72 +16,10 @@
|
||||
|
||||
package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
|
||||
//TODO:
|
||||
//Inlining turned off
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public abstract class InlineTest extends SingleFileTranslationTest {
|
||||
public final class InlineTest extends SingleFileTranslationTest {
|
||||
public InlineTest() {
|
||||
super("inline/");
|
||||
}
|
||||
|
||||
public void testFunctionWithoutParameters() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("functionWithoutParameters.kt", "myInlineFun");
|
||||
}
|
||||
|
||||
public void testFunctionWithBlockBody() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("functionWithBlockBody.kt", "myInlineFun");
|
||||
}
|
||||
|
||||
public void testFunctionWithOneParameter() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("functionWithOneParameter.kt", "myInlineFun");
|
||||
}
|
||||
|
||||
public void testFunctionWithTwoParameters() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("functionWithTwoParameters.kt", "myInlineFun");
|
||||
}
|
||||
|
||||
public void testMethod() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("method.kt", "myInlineMethod");
|
||||
}
|
||||
|
||||
public void testMethodWithReferenceToThis() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("methodWithReferenceToThis.kt", "myInlineMethod");
|
||||
}
|
||||
|
||||
public void testMethodWithIndirectlyReferencedThis() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("methodWithIndirectlyReferencedThis.kt", "myInlineMethod");
|
||||
}
|
||||
|
||||
public void testExtension() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("extension.kt", "myInlineExtension");
|
||||
}
|
||||
|
||||
public void testExtensionWithParameter() throws Exception {
|
||||
checkFooBoxIsTrueAndFunctionNameIsNotReferenced("extensionWithParameter.kt", "myInlineExtension");
|
||||
}
|
||||
|
||||
private void checkFooBoxIsTrueAndFunctionNameIsNotReferenced(@NotNull String filename, String funName) throws Exception {
|
||||
fooBoxTest();
|
||||
String generatedJSFilePath = getOutputFilePath(filename, EcmaVersion.defaultVersion());
|
||||
String outputFileText = FileUtil.loadFile(new File(generatedJSFilePath), true);
|
||||
assertTrue(countOccurrences(outputFileText, funName) == 1);
|
||||
}
|
||||
|
||||
private static int countOccurrences(@NotNull String str, @NotNull String subStr) {
|
||||
int count = 0;
|
||||
String s = str;
|
||||
while (s.contains(subStr)) {
|
||||
s = s.replaceFirst(subStr, "");
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user