js enumerable for ecma5
This commit is contained in:
@@ -16,10 +16,14 @@
|
||||
|
||||
package org.jetbrains.k2js.test.semantics;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.k2js.config.EcmaVersion;
|
||||
import org.jetbrains.k2js.test.SingleFileTranslationTest;
|
||||
import org.jetbrains.k2js.test.utils.JsTestUtils;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
@@ -79,4 +83,18 @@ public final class PropertyAccessTest extends SingleFileTranslationTest {
|
||||
public void testInitInstanceProperties() throws Exception {
|
||||
fooBoxTest(EnumSet.of(EcmaVersion.v5));
|
||||
}
|
||||
|
||||
public void testEnumerable() throws Exception {
|
||||
fooBoxTest(JsTestUtils.successOnEcmaV5());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected List<String> additionalJSFiles(@NotNull EcmaVersion ecmaVersion) {
|
||||
List<String> result = Lists.newArrayList(super.additionalJSFiles(ecmaVersion));
|
||||
if (getName().equals("testEnumerable")) {
|
||||
result.add(pathToTestFiles() + "enumerate.js");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,11 @@ public final class JsTestUtils {
|
||||
private JsTestUtils() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static EnumSet<EcmaVersion> successOnEcmaV5() {
|
||||
return EnumSet.of(EcmaVersion.v5);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String convertFileNameToDotJsFile(@NotNull String filename, @NotNull EcmaVersion ecmaVersion) {
|
||||
String postFix = "_" + ecmaVersion.toString() + ".js";
|
||||
|
||||
Reference in New Issue
Block a user