Requested only one commit pull request (was: https://github.com/JetBrains/kotlin/pull/59/files).
Note: all tests passed, but I haven't tested this build in real life (opposite to my master branch). Don't remember about critical issue — http://youtrack.jetbrains.com/issue/KT-2154 Fix for this issue is not included in this patch (because unrelated). Fix for it and for all other unrelated changes will be opened as separated pull-requests.
This commit is contained in:
@@ -26,8 +26,8 @@ import org.jetbrains.k2js.test.rhino.RhinoResultChecker;
|
||||
import org.jetbrains.k2js.test.utils.TranslationUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -44,6 +44,8 @@ public abstract class BasicTest extends TestWithEnvironment {
|
||||
private static final String CASES = "cases/";
|
||||
private static final String OUT = "out/";
|
||||
private static final String KOTLIN_JS_LIB = pathToTestFilesRoot() + "kotlin_lib.js";
|
||||
private static final String KOTLIN_JS_LIB_ECMA_3 = pathToTestFilesRoot() + "kotlin_lib_ecma3.js";
|
||||
private static final String KOTLIN_JS_LIB_ECMA_5 = pathToTestFilesRoot() + "kotlin_lib_ecma5.js";
|
||||
private static final String EXPECTED = "expected/";
|
||||
|
||||
@NotNull
|
||||
@@ -87,28 +89,32 @@ public abstract class BasicTest extends TestWithEnvironment {
|
||||
assert success;
|
||||
}
|
||||
|
||||
protected List<String> additionalJSFiles() {
|
||||
return Collections.singletonList(KOTLIN_JS_LIB);
|
||||
protected List<String> additionalJSFiles(EcmaVersion ecmaVersion) {
|
||||
List<String> list = new ArrayList<String>(2);
|
||||
list.add(ecmaVersion == EcmaVersion.v5 ? KOTLIN_JS_LIB_ECMA_5 : KOTLIN_JS_LIB_ECMA_3);
|
||||
list.add(KOTLIN_JS_LIB);
|
||||
return list;
|
||||
}
|
||||
|
||||
protected void generateJavaScriptFiles(@NotNull String kotlinFilename,
|
||||
@NotNull MainCallParameters mainCallParameters,
|
||||
@NotNull EnumSet<EcmaVersion> ecmaVersions) throws Exception {
|
||||
@NotNull Iterable<EcmaVersion> ecmaVersions) throws Exception {
|
||||
generateJavaScriptFiles(Collections.singletonList(getInputFilePath(kotlinFilename)), kotlinFilename, mainCallParameters,
|
||||
ecmaVersions);
|
||||
}
|
||||
|
||||
protected void generateJavaScriptFiles(@NotNull List<String> files, @NotNull String testName,
|
||||
@NotNull MainCallParameters mainCallParameters, @NotNull EnumSet<EcmaVersion> ecmaVersions)
|
||||
@NotNull MainCallParameters mainCallParameters, @NotNull Iterable<EcmaVersion> ecmaVersions)
|
||||
throws Exception {
|
||||
for (EcmaVersion version : ecmaVersions) {
|
||||
TranslationUtils.translateFiles(getProject(), files, getOutputFilePath(testName, version), mainCallParameters, version);
|
||||
}
|
||||
}
|
||||
|
||||
protected void runRhinoTests(@NotNull List<String> outputFilePaths, @NotNull RhinoResultChecker checker) throws Exception {
|
||||
for (String outputFilePath : outputFilePaths) {
|
||||
runRhinoTest(withAdditionalFiles(outputFilePath), checker, getRhinoTestVariables());
|
||||
protected void runRhinoTests(@NotNull String filename, @NotNull Iterable<EcmaVersion> ecmaVersions, @NotNull RhinoResultChecker checker) throws Exception {
|
||||
for (EcmaVersion ecmaVersion : ecmaVersions) {
|
||||
runRhinoTest(withAdditionalFiles(getOutputFilePath(filename, ecmaVersion), ecmaVersion), checker, getRhinoTestVariables(),
|
||||
ecmaVersion);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,21 +161,12 @@ public abstract class BasicTest extends TestWithEnvironment {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<String> withAdditionalFiles(@NotNull String inputFile) {
|
||||
List<String> allFiles = Lists.newArrayList(additionalJSFiles());
|
||||
protected List<String> withAdditionalFiles(@NotNull String inputFile, EcmaVersion ecmaVersion) {
|
||||
List<String> allFiles = Lists.newArrayList(additionalJSFiles(ecmaVersion));
|
||||
allFiles.add(inputFile);
|
||||
return allFiles;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<String> getOutputFilePaths(@NotNull String filename, @NotNull EnumSet<EcmaVersion> ecmaVersions) {
|
||||
List<String> result = Lists.newArrayList();
|
||||
for (EcmaVersion ecmaVersion : ecmaVersions) {
|
||||
result.add(getOutputFilePath(filename, ecmaVersion));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String getOutputFilePath(@NotNull String filename, @NotNull EcmaVersion ecmaVersion) {
|
||||
return getOutputPath() + convertFileNameToDotJsFile(filename, ecmaVersion);
|
||||
|
||||
@@ -51,8 +51,7 @@ public abstract class MultipleFilesTranslationTest extends BasicTest {
|
||||
@NotNull Object expectedResult)
|
||||
throws Exception {
|
||||
generateJsFromDir(dirName, ecmaVersions);
|
||||
runRhinoTests(getOutputFilePaths(dirName + ".kt", ecmaVersions),
|
||||
new RhinoFunctionResultChecker(namespaceName, functionName, expectedResult));
|
||||
runRhinoTests(dirName + ".kt", ecmaVersions, new RhinoFunctionResultChecker(namespaceName, functionName, expectedResult));
|
||||
}
|
||||
|
||||
public void checkFooBoxIsTrue(@NotNull String dirName) throws Exception {
|
||||
|
||||
@@ -47,8 +47,7 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
||||
@NotNull String functionName,
|
||||
@NotNull Object expectedResult) throws Exception {
|
||||
generateJavaScriptFiles(kotlinFilename, MainCallParameters.noCall(), ecmaVersions);
|
||||
runRhinoTests(getOutputFilePaths(kotlinFilename, ecmaVersions),
|
||||
new RhinoFunctionResultChecker(namespaceName, functionName, expectedResult));
|
||||
runRhinoTests(kotlinFilename, ecmaVersions, new RhinoFunctionResultChecker(namespaceName, functionName, expectedResult));
|
||||
}
|
||||
|
||||
public void checkFooBoxIsTrue(@NotNull String filename, @NotNull EnumSet<EcmaVersion> ecmaVersions) throws Exception {
|
||||
@@ -82,7 +81,7 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
||||
@NotNull EnumSet<EcmaVersion> ecmaVersions,
|
||||
String... args) throws Exception {
|
||||
generateJavaScriptFiles(kotlinFilename, MainCallParameters.mainWithArguments(Lists.newArrayList(args)), ecmaVersions);
|
||||
runRhinoTests(getOutputFilePaths(kotlinFilename, ecmaVersions), new RhinoSystemOutputChecker(expectedResult));
|
||||
runRhinoTests(kotlinFilename, ecmaVersions, new RhinoSystemOutputChecker(expectedResult));
|
||||
}
|
||||
|
||||
protected void performTestWithMain(@NotNull EnumSet<EcmaVersion> ecmaVersions,
|
||||
|
||||
@@ -21,7 +21,6 @@ import org.mozilla.javascript.Context;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
@@ -61,7 +60,7 @@ public class RhinoFunctionResultChecker implements RhinoResultChecker {
|
||||
private String functionCallString() {
|
||||
String result = functionName + "()";
|
||||
if (namespaceName != null) {
|
||||
result = namespaceName + "." + result;
|
||||
result = "Kotlin.defs." + namespaceName + "." + result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.k2js.test.rhino;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.mozilla.javascript.Context;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
|
||||
@@ -48,13 +50,19 @@ public final class RhinoUtils {
|
||||
public static void runRhinoTest(@NotNull List<String> fileNames,
|
||||
@NotNull RhinoResultChecker checker) throws Exception {
|
||||
|
||||
runRhinoTest(fileNames, checker, null);
|
||||
runRhinoTest(fileNames, checker, null, EcmaVersion.defaultVersion());
|
||||
}
|
||||
|
||||
public static void runRhinoTest(@NotNull List<String> fileNames,
|
||||
@NotNull RhinoResultChecker checker,
|
||||
Map<String,Object> variables) throws Exception {
|
||||
@Nullable Map<String, Object> variables,
|
||||
@NotNull EcmaVersion ecmaVersion) throws Exception {
|
||||
Context context = Context.enter();
|
||||
if (ecmaVersion == EcmaVersion.v5) {
|
||||
// actually, currently, doesn't matter because dart doesn't produce js 1.8 code (expression closures)
|
||||
context.setLanguageVersion(Context.VERSION_1_8);
|
||||
}
|
||||
|
||||
Scriptable scope = context.initStandardObjects();
|
||||
if (variables != null) {
|
||||
Set<Map.Entry<String,Object>> entries = variables.entrySet();
|
||||
|
||||
@@ -18,12 +18,11 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.BasicTest;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
import org.jetbrains.k2js.translate.context.Namer;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
@SuppressWarnings("JUnitTestCaseWithNoTests")
|
||||
public final class ExamplesTest extends SingleFileTranslationTest {
|
||||
|
||||
@@ -38,7 +37,7 @@ public final class ExamplesTest extends SingleFileTranslationTest {
|
||||
|
||||
@Override
|
||||
public void runTest() throws Exception {
|
||||
runFunctionOutputTest(failsOnEcmaV5(), filename, Namer.getRootNamespaceName(), "box", "OK");
|
||||
runFunctionOutputTest(EcmaVersion.all(), filename, Namer.getRootNamespaceName(), "box", "OK");
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
@@ -30,14 +28,14 @@ public final class ExtensionPropertyTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testSimplePropertyWithGetter() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testPropertyWithGetterAndSetter() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testAbsExtension() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker;
|
||||
import org.jetbrains.k2js.test.rhino.RhinoResultChecker;
|
||||
@@ -35,7 +36,7 @@ public final class KotlinLibTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testKotlinJsLibRunsWithRhino() throws Exception {
|
||||
runRhinoTest(additionalJSFiles(), new RhinoResultChecker() {
|
||||
runRhinoTest(additionalJSFiles(EcmaVersion.v3), new RhinoResultChecker() {
|
||||
@Override
|
||||
public void runChecks(Context context, Scriptable scope) throws Exception {
|
||||
//do nothing
|
||||
@@ -83,7 +84,7 @@ public final class KotlinLibTest extends SingleFileTranslationTest {
|
||||
|
||||
|
||||
private void runJavascriptTest(@NotNull String filename) throws Exception {
|
||||
runRhinoTest(withAdditionalFiles(cases(filename)),
|
||||
runRhinoTest(withAdditionalFiles(cases(filename), EcmaVersion.v3),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.translate.context.Namer;
|
||||
import org.mozilla.javascript.JavaScriptException;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
* <p/>
|
||||
@@ -38,7 +36,7 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
public void testIntRange() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +45,7 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
public void testClassWithoutNamespace() throws Exception {
|
||||
runFunctionOutputTest(failsOnEcmaV5(), "classWithoutNamespace.kt", Namer.getRootNamespaceName(), "box", true);
|
||||
runFunctionOutputTest("classWithoutNamespace.kt", Namer.getRootNamespaceName(), "box", true);
|
||||
}
|
||||
|
||||
public void testIfElseAsExpressionWithThrow() throws Exception {
|
||||
@@ -73,7 +71,7 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
public void testKt740_2() throws Exception {
|
||||
checkFooBoxIsOk(failsOnEcmaV5(), "KT-740-2.kt");
|
||||
checkFooBoxIsOk("KT-740-2.kt");
|
||||
}
|
||||
|
||||
public void testKt1361_1() throws Exception {
|
||||
@@ -89,7 +87,7 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
public void testKt740_3() throws Exception {
|
||||
checkFooBoxIsOk(failsOnEcmaV5(), "KT-740-3.kt");
|
||||
checkFooBoxIsOk("KT-740-3.kt");
|
||||
}
|
||||
|
||||
public void testFunInConstructor() throws Exception {
|
||||
@@ -109,11 +107,11 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
public void testExtensionLiteralCreatedAtNamespaceLevel() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testTemporaryVariableCreatedInNamespaceInitializer() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testWhenReturnedWithoutBlock() throws Exception {
|
||||
|
||||
@@ -37,8 +37,8 @@ public final class NativeInteropTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> additionalJSFiles() {
|
||||
List<String> result = Lists.newArrayList(super.additionalJSFiles());
|
||||
protected List<String> additionalJSFiles(EcmaVersion ecmaVersion) {
|
||||
List<String> result = Lists.newArrayList(super.additionalJSFiles(ecmaVersion));
|
||||
result.addAll(JsTestUtils.getAllFilesInDir(pathToTestFiles() + NATIVE));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
@@ -60,7 +58,7 @@ public final class OperatorOverloadingTest extends SingleFileTranslationTest {
|
||||
|
||||
|
||||
public void testOperatorOverloadOnPropertyCallGetterAndSetterOnlyOnce() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
import java.util.EnumSet;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
@@ -45,12 +46,12 @@ public final class PropertyAccessTest extends SingleFileTranslationTest {
|
||||
|
||||
|
||||
public void testCustomGetter() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testCustomSetter() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testNamespacePropertyInitializer() throws Exception {
|
||||
@@ -63,7 +64,7 @@ public final class PropertyAccessTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testNamespaceCustomAccessors() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,4 +75,8 @@ public final class PropertyAccessTest extends SingleFileTranslationTest {
|
||||
public void testExtensionLiteralSafeCall() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testInitInstanceProperties() throws Exception {
|
||||
fooBoxTest(EnumSet.of(EcmaVersion.v5));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
@@ -30,12 +28,12 @@ public final class RangeTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testExplicitRange() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
public void testRangeSugarSyntax() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
@@ -45,7 +43,7 @@ public final class StandardClassesTest extends SingleFileTranslationTest {
|
||||
|
||||
|
||||
public void testArrayFunctionConstructor() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +60,6 @@ public final class StandardClassesTest extends SingleFileTranslationTest {
|
||||
|
||||
|
||||
public void testArraysIterator() throws Exception {
|
||||
fooBoxTest(failsOnEcmaV5());
|
||||
fooBoxTest();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.facade.MainCallParameters;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
import org.jetbrains.k2js.test.rhino.RhinoFunctionNativeObjectResultChecker;
|
||||
import org.jetbrains.k2js.test.rhino.RhinoFunctionResultChecker;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
@@ -44,11 +43,11 @@ public final class StdLibTest extends SingleFileTranslationTest {
|
||||
@Override
|
||||
protected void generateJavaScriptFiles(@NotNull String kotlinFilename,
|
||||
@NotNull MainCallParameters mainCallParameters,
|
||||
@NotNull EnumSet<EcmaVersion> ecmaVersions) throws Exception {
|
||||
@NotNull Iterable<EcmaVersion> ecmaVersions) throws Exception {
|
||||
List<String> files = Arrays.asList(getInputFilePath(kotlinFilename));
|
||||
|
||||
generateJavaScriptFiles(files, kotlinFilename, mainCallParameters, ecmaVersions);
|
||||
runRhinoTests(getOutputFilePaths(kotlinFilename, ecmaVersions),
|
||||
runRhinoTests(kotlinFilename, ecmaVersions,
|
||||
new RhinoFunctionNativeObjectResultChecker("test.browser", "foo", "Some Dynamically Created Content!!!"));
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
import org.mozilla.javascript.EcmaError;
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
|
||||
import static org.jetbrains.k2js.test.utils.JsTestUtils.failsOnEcmaV5;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
@@ -35,11 +33,11 @@ public final class WebDemoExamples2Test extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testLife() throws Exception {
|
||||
performTestWithMain(failsOnEcmaV5(), "life", "", "2");
|
||||
performTestWithMain("life", "", "2");
|
||||
}
|
||||
|
||||
public void testBuilder() throws Exception {
|
||||
performTestWithMain(failsOnEcmaV5(), "builder", "");
|
||||
performTestWithMain(failsOnEcmaV5(), "builder", "1", "over9000");
|
||||
performTestWithMain("builder", "");
|
||||
performTestWithMain("builder", "1", "over9000");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public final class JsTestUtils {
|
||||
return failsOn(EcmaVersion.v5);
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
public static String convertFileNameToDotJsFile(@NotNull String filename, EcmaVersion ecmaVersion) {
|
||||
String postFix = "_" + ecmaVersion.toString() + ".js";
|
||||
|
||||
@@ -57,7 +57,6 @@ public final class TranslationUtils {
|
||||
JsProgram program = getTranslator(project, version).generateProgram(psiFiles, mainCallParameters);
|
||||
FileWriter writer = new FileWriter(new File(outputFile));
|
||||
try {
|
||||
writer.write("\"use strict\";\n");
|
||||
writer.write(CodeGenerator.toString(program));
|
||||
}
|
||||
finally {
|
||||
|
||||
Reference in New Issue
Block a user