JS: move more test to box tests
This commit is contained in:
@@ -82,7 +82,6 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
private static final String OUT = "out/";
|
||||
private static final String EXPECTED = "expected/";
|
||||
private static final String COMMON_FILES_DIR = "_commonFiles/";
|
||||
public static final String MODULE_EMULATION_FILE = TEST_DATA_DIR_PATH + "/moduleEmulation.js";
|
||||
|
||||
public static final String TEST_MODULE = "JS_TESTS";
|
||||
public static final String TEST_PACKAGE = "foo";
|
||||
@@ -104,16 +103,9 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
return KotlinCoreEnvironment.createForTests(getTestRootDisposable(), new CompilerConfiguration(), EnvironmentConfigFiles.JS_CONFIG_FILES);
|
||||
}
|
||||
|
||||
protected boolean shouldCreateOut() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
if (!shouldCreateOut()) {
|
||||
return;
|
||||
}
|
||||
File outDir = new File(getOutputPath());
|
||||
|
||||
KotlinTestUtils.mkdirs(outDir);
|
||||
@@ -122,8 +114,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
//noinspection ConstantConditions,PointlessBooleanExpression
|
||||
if (!shouldCreateOut() || !DELETE_OUT) {
|
||||
if (!DELETE_OUT) {
|
||||
return;
|
||||
}
|
||||
File outDir = new File(getOutputPath());
|
||||
@@ -158,7 +149,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
generateJavaScriptFiles(files, testName, mainCallParameters, ecmaVersions, TEST_MODULE, null);
|
||||
}
|
||||
|
||||
protected void generateJavaScriptFiles(
|
||||
private void generateJavaScriptFiles(
|
||||
@NotNull List<String> files,
|
||||
@NotNull String testName,
|
||||
@NotNull MainCallParameters mainCallParameters,
|
||||
@@ -171,7 +162,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateJavaScriptFiles(
|
||||
private void generateJavaScriptFiles(
|
||||
@NotNull List<String> files,
|
||||
@NotNull String testName,
|
||||
@NotNull MainCallParameters mainCallParameters,
|
||||
@@ -190,11 +181,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
translateFiles(jetFiles, outputFile, mainCallParameters, config);
|
||||
}
|
||||
|
||||
protected String getModuleDirectoryName(String dirName, String moduleName) {
|
||||
return dirName + File.separator + moduleName;
|
||||
}
|
||||
|
||||
protected void translateFiles(
|
||||
private void translateFiles(
|
||||
@NotNull List<KtFile> jetFiles,
|
||||
@NotNull File outputFile,
|
||||
@NotNull MainCallParameters mainCallParameters,
|
||||
@@ -241,11 +228,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean shouldGenerateMetaInfo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void processJsProgram(@NotNull JsProgram program, @NotNull List<KtFile> jetFiles) throws Exception {
|
||||
private static void processJsProgram(@NotNull JsProgram program, @NotNull List<KtFile> jetFiles) throws Exception {
|
||||
for (KtFile file : jetFiles) {
|
||||
String text = file.getText();
|
||||
DirectiveTestUtils.processDirectives(program, text);
|
||||
@@ -304,7 +287,7 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
// helpers
|
||||
|
||||
@NotNull
|
||||
protected final String pathToTestDir() {
|
||||
private String pathToTestDir() {
|
||||
return TEST_DATA_DIR_PATH + relativePathToTestDir;
|
||||
}
|
||||
|
||||
@@ -345,12 +328,10 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
configuration.put(JSConfigurationKeys.TARGET, ecmaVersion);
|
||||
|
||||
configuration.put(JSConfigurationKeys.SOURCE_MAP, shouldGenerateSourceMap());
|
||||
configuration.put(JSConfigurationKeys.META_INFO, shouldGenerateMetaInfo());
|
||||
configuration.put(JSConfigurationKeys.META_INFO, false);
|
||||
|
||||
configuration.put(JSConfigurationKeys.UNIT_TEST_CONFIG, shouldBeTranslateAsUnitTestClass());
|
||||
|
||||
setupConfig(configuration);
|
||||
|
||||
return new LibrarySourcesConfig(project, configuration);
|
||||
}
|
||||
|
||||
@@ -364,17 +345,13 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setupConfig(@NotNull CompilerConfiguration configuration) {
|
||||
// Do nothing by default, expect inheritors to implement this method
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String getOutputPath() {
|
||||
private String getOutputPath() {
|
||||
return pathToTestDir() + OUT;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String getInputPath() {
|
||||
private String getInputPath() {
|
||||
return pathToTestDir() + CASES;
|
||||
}
|
||||
|
||||
@@ -419,7 +396,6 @@ public abstract class BasicTest extends KotlinTestWithEnvironment {
|
||||
protected String getPackageName(@NotNull String filename) throws IOException {
|
||||
String content = FileUtil.loadFile(new File(filename), true);
|
||||
KtPsiFactory psiFactory = new KtPsiFactory(getProject());
|
||||
KtFile jetFile = psiFactory.createFile(content);
|
||||
KtFile ktFile = psiFactory.createFile(content);
|
||||
return getPackageName(ktFile);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
||||
runFunctionOutputTestByPaths(ecmaVersions, Collections.singletonList(kotlinFilePath), packageName, functionName, expectedResult);
|
||||
}
|
||||
|
||||
protected void runFunctionOutputTestByPaths(
|
||||
private void runFunctionOutputTestByPaths(
|
||||
@NotNull Iterable<EcmaVersion> ecmaVersions,
|
||||
@NotNull List<String> kotlinFilePaths,
|
||||
@NotNull String packageName,
|
||||
@@ -76,22 +76,6 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
||||
runRhinoTests(testName, ecmaVersions, checker);
|
||||
}
|
||||
|
||||
private void checkFooBoxIsTrue(@NotNull String filename, @NotNull Iterable<EcmaVersion> ecmaVersions) throws Exception {
|
||||
runFunctionOutputTest(ecmaVersions, filename, TEST_PACKAGE, TEST_FUNCTION, true);
|
||||
}
|
||||
|
||||
protected void checkFooBoxIsTrue(@NotNull String filename) throws Exception {
|
||||
runFunctionOutputTest(DEFAULT_ECMA_VERSIONS, filename, TEST_PACKAGE, TEST_FUNCTION, true);
|
||||
}
|
||||
|
||||
protected void fooBoxTest() throws Exception {
|
||||
checkFooBoxIsTrue(getTestName(true) + ".kt", DEFAULT_ECMA_VERSIONS);
|
||||
}
|
||||
|
||||
protected void checkFooBoxIsOk() throws Exception {
|
||||
checkFooBoxIsOk(getTestName(true) + ".kt");
|
||||
}
|
||||
|
||||
protected void checkFooBoxIsOk(@NotNull String filename) throws Exception {
|
||||
checkFooBoxIsOkByPath(getInputFilePath(filename));
|
||||
}
|
||||
@@ -101,10 +85,6 @@ public abstract class SingleFileTranslationTest extends BasicTest {
|
||||
runFunctionOutputTestByPath(DEFAULT_ECMA_VERSIONS, filePath, TEST_PACKAGE, TEST_FUNCTION, "OK");
|
||||
}
|
||||
|
||||
protected void checkBlackBoxIsOkByPath(@NotNull String filePath) throws Exception {
|
||||
runFunctionOutputTestByPath(DEFAULT_ECMA_VERSIONS, filePath, getPackageName(filePath), TEST_FUNCTION, "OK");
|
||||
}
|
||||
|
||||
protected void checkOutput(@NotNull String kotlinFilename,
|
||||
@NotNull String expectedResult,
|
||||
@NotNull String... args) throws Exception {
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
public final class AbstractListTest extends JavaClassesTest {
|
||||
|
||||
public AbstractListTest() {
|
||||
super("abstractList/");
|
||||
}
|
||||
|
||||
public void testIterator() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
import org.mozilla.javascript.JavaScriptException;
|
||||
|
||||
public final class ArrayListTest extends JavaClassesTest {
|
||||
|
||||
public ArrayListTest() {
|
||||
super("arrayList/");
|
||||
}
|
||||
|
||||
public void testEmptyList() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testAccess() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testIsEmpty() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testArrayAccess() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testIterate() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testRemove() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testRemoveWithIndexOutOfBounds() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testToArray() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testIndexOOB() throws Exception {
|
||||
try {
|
||||
fooBoxTest();
|
||||
fail();
|
||||
} catch (JavaScriptException e) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
|
||||
public void testMisc() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testConstructWithCapacity() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testConstructWithSideEffectParam() throws Exception {
|
||||
fooBoxTest();
|
||||
}
|
||||
|
||||
public void testIndexOf() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testContainsAll() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testRemoveAll() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testRetainAll() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
@@ -1388,6 +1388,189 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/examples")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Examples extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInExamples() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/examples"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("basicmethod.kt")
|
||||
public void testBasicmethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/basicmethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("basicproperty.kt")
|
||||
public void testBasicproperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/basicproperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("classObject.kt")
|
||||
public void testClassObject() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/classObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("closureWithParameter.kt")
|
||||
public void testClosureWithParameter() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/closureWithParameter.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("closureWithParameterAndBoxing.kt")
|
||||
public void testClosureWithParameterAndBoxing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/closureWithParameterAndBoxing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("doubleEnclosedLocalVariable.kt")
|
||||
public void testDoubleEnclosedLocalVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/doubleEnclosedLocalVariable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enclosed.kt")
|
||||
public void testEnclosed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/enclosed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enclosingLocalVariable.kt")
|
||||
public void testEnclosingLocalVariable() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/enclosingLocalVariable.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("extensionClosure.kt")
|
||||
public void testExtensionClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/extensionClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("funDelegation.kt")
|
||||
public void testFunDelegation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/funDelegation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("incrementProperty.kt")
|
||||
public void testIncrementProperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/incrementProperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inheritance.kt")
|
||||
public void testInheritance() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/inheritance.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedInnerClass.kt")
|
||||
public void testInheritedInnerClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/inheritedInnerClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedMethod.kt")
|
||||
public void testInheritedMethod() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/inheritedMethod.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initializerBlock.kt")
|
||||
public void testInitializerBlock() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/initializerBlock.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("initializerBlockDImpl.kt")
|
||||
public void testInitializerBlockDImpl() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/initializerBlockDImpl.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("innerClass.kt")
|
||||
public void testInnerClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/innerClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kt242.kt")
|
||||
public void testKt242() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/kt242.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("newInstanceDefaultConstructor.kt")
|
||||
public void testNewInstanceDefaultConstructor() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/newInstanceDefaultConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadBinaryOperator.kt")
|
||||
public void testOverloadBinaryOperator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/overloadBinaryOperator.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPlusAssignReturn.kt")
|
||||
public void testOverloadPlusAssignReturn() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/overloadPlusAssignReturn.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadPlusToPlusAssign.kt")
|
||||
public void testOverloadPlusToPlusAssign() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/overloadPlusToPlusAssign.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("overloadUnaryOperator.kt")
|
||||
public void testOverloadUnaryOperator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/overloadUnaryOperator.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyDelegation.kt")
|
||||
public void testPropertyDelegation() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/propertyDelegation.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("propertyInInitializer.kt")
|
||||
public void testPropertyInInitializer() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/propertyInInitializer.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("rightHandOverride.kt")
|
||||
public void testRightHandOverride() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/rightHandOverride.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simplestClosure.kt")
|
||||
public void testSimplestClosure() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/simplestClosure.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("simplestClosureAndBoxing.kt")
|
||||
public void testSimplestClosureAndBoxing() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/simplestClosureAndBoxing.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("traitproperty.kt")
|
||||
public void testTraitproperty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/examples/traitproperty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/expression")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -4322,6 +4505,135 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/java")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Java extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInJava() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/java"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/java/abstractList")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class AbstractList extends AbstractBoxJsTest {
|
||||
public void testAllFilesPresentInAbstractList() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/java/abstractList"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("iterator.kt")
|
||||
public void testIterator() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/abstractList/iterator.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/java/arrayList")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class ArrayList extends AbstractBoxJsTest {
|
||||
@TestMetadata("access.kt")
|
||||
public void testAccess() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/access.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInArrayList() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("js/js.translator/testData/box/java/arrayList"), Pattern.compile("^([^_](.+))\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("arrayAccess.kt")
|
||||
public void testArrayAccess() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/arrayAccess.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructWithCapacity.kt")
|
||||
public void testConstructWithCapacity() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/constructWithCapacity.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("constructWithSideEffectParam.kt")
|
||||
public void testConstructWithSideEffectParam() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/constructWithSideEffectParam.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("containsAll.kt")
|
||||
public void testContainsAll() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/containsAll.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("emptyList.kt")
|
||||
public void testEmptyList() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/emptyList.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("indexOOB.kt")
|
||||
public void testIndexOOB() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/indexOOB.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("indexOf.kt")
|
||||
public void testIndexOf() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/indexOf.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("isEmpty.kt")
|
||||
public void testIsEmpty() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/isEmpty.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("iterate.kt")
|
||||
public void testIterate() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/iterate.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("misc.kt")
|
||||
public void testMisc() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/misc.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("remove.kt")
|
||||
public void testRemove() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/remove.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("removeAll.kt")
|
||||
public void testRemoveAll() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/removeAll.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("removeWithIndexOutOfBounds.kt")
|
||||
public void testRemoveWithIndexOutOfBounds() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/removeWithIndexOutOfBounds.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("retainAll.kt")
|
||||
public void testRetainAll() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/retainAll.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("toArray.kt")
|
||||
public void testToArray() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/java/arrayList/toArray.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("js/js.translator/testData/box/jsCode")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
import org.jetbrains.kotlin.js.translate.context.Namer;
|
||||
|
||||
@SuppressWarnings("JUnitTestCaseWithNoTests")
|
||||
public final class ExamplesTest extends SingleFileTranslationTest {
|
||||
|
||||
@NotNull
|
||||
private final String filename;
|
||||
|
||||
@SuppressWarnings("JUnitTestCaseWithNonTrivialConstructors")
|
||||
public ExamplesTest(@NotNull String filename) {
|
||||
super("examples/");
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runTest() throws Exception {
|
||||
runFunctionOutputTest(filename, Namer.getRootPackageName(), TEST_FUNCTION, "OK");
|
||||
}
|
||||
|
||||
public static Test suite() throws Exception {
|
||||
return TranslatorTestCaseBuilder
|
||||
.suiteForDirectory(TEST_DATA_DIR_PATH + "examples/cases/", new TranslatorTestCaseBuilder.NamedTestFactory() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Test createTest(@NotNull String filename) {
|
||||
ExamplesTest examplesTest = new ExamplesTest(filename);
|
||||
examplesTest.setName(filename);
|
||||
return examplesTest;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.js.test.semantics;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.js.test.SingleFileTranslationTest;
|
||||
|
||||
public abstract class JavaClassesTest extends SingleFileTranslationTest {
|
||||
|
||||
public JavaClassesTest(@NotNull String main) {
|
||||
super("java/" + main);
|
||||
}
|
||||
}
|
||||
@@ -42,4 +42,8 @@ public final class PackageTest extends SingleFileTranslationTest {
|
||||
public void testInitializersOfNestedPackagesExecute() throws Exception {
|
||||
runFunctionOutputTest("initializersOfNestedPackagesExecute.kt", "foo1.foo2.foo3.foo5.foo6.foo7.foo8", TEST_FUNCTION, true);
|
||||
}
|
||||
|
||||
public void testMainFunInNestedPackage() throws Exception {
|
||||
checkOutput("mainFunInNestedPackage.kt", "ayee");
|
||||
}
|
||||
}
|
||||
|
||||
+14
-5
@@ -19,8 +19,17 @@ package org.jetbrains.kotlin.js.test.semantics
|
||||
import org.jetbrains.kotlin.js.test.BasicBoxTest
|
||||
|
||||
abstract class BorrowedTest(relativePath: String) : BasicBoxTest(
|
||||
"compiler/testData/codegen/box/" + relativePath,
|
||||
BasicBoxTest.TEST_DATA_DIR_PATH + relativePath + "out/"
|
||||
"compiler/testData/codegen/box/$relativePath",
|
||||
"${BasicBoxTest.TEST_DATA_DIR_PATH}/out/jvm/box/$relativePath/"
|
||||
) {
|
||||
init {
|
||||
additionalCommonFileDirectories += BasicBoxTest.TEST_DATA_DIR_PATH + relativePath + "/_commonFiles/"
|
||||
}
|
||||
}
|
||||
|
||||
abstract class BorrowedInlineTest(relativePath: String) : BasicBoxTest(
|
||||
"compiler/testData/codegen/boxInline/$relativePath",
|
||||
"${BasicBoxTest.TEST_DATA_DIR_PATH}/out/jvm/boxInline/$relativePath/"
|
||||
) {
|
||||
init {
|
||||
additionalCommonFileDirectories += BasicBoxTest.TEST_DATA_DIR_PATH + relativePath + "/_commonFiles/"
|
||||
@@ -29,14 +38,14 @@ abstract class BorrowedTest(relativePath: String) : BasicBoxTest(
|
||||
|
||||
abstract class AbstractBoxJsTest() : BasicBoxTest(
|
||||
BasicBoxTest.TEST_DATA_DIR_PATH + "box/",
|
||||
BasicBoxTest.TEST_DATA_DIR_PATH + "out/"
|
||||
BasicBoxTest.TEST_DATA_DIR_PATH + "out/box/"
|
||||
)
|
||||
|
||||
abstract class AbstractBridgeTest : BorrowedTest("bridges/")
|
||||
|
||||
abstract class AbstractCompanionObjectTest : BorrowedTest("objectIntrinsics/")
|
||||
|
||||
abstract class AbstractFunctionExpressionTest : BorrowedTest("functionExpression/")
|
||||
abstract class AbstractFunctionExpressionTest : BorrowedTest("functions/functionExpression/")
|
||||
|
||||
abstract class AbstractSecondaryConstructorTest : BorrowedTest("secondaryConstructors/")
|
||||
|
||||
@@ -48,6 +57,6 @@ abstract class AbstractSuperTest : BorrowedTest("super/")
|
||||
|
||||
abstract class AbstractLocalClassesTest : BorrowedTest("localClasses/")
|
||||
|
||||
abstract class AbstractNonLocalReturnsTest : BorrowedTest("inline.generated/nonLocalReturns/")
|
||||
abstract class AbstractNonLocalReturnsTest : BorrowedInlineTest("nonLocalReturns/")
|
||||
|
||||
abstract class AbstractTypeAliasesTests : BorrowedTest("typealias/")
|
||||
Reference in New Issue
Block a user