Remove patch.
Refactor tests.
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2012 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.k2js.test;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
//TODO: remove class
|
||||
public class BasicClassTest extends TranslationTest {
|
||||
|
||||
final private static String MAIN = "class/";
|
||||
|
||||
@Override
|
||||
protected String mainDirectory() {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
public void testClassWithoutNamespace() throws Exception {
|
||||
testFunctionOutput("classWithoutNamespace.kt", "Anonymous", "box", true);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -20,7 +20,8 @@ import com.intellij.testFramework.UsefulTestCase;
|
||||
import junit.framework.Test;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class ExampleTestSuite extends UsefulTestCase {
|
||||
@SuppressWarnings("JUnitTestCaseWithNoTests")
|
||||
public final class ExamplesTest extends UsefulTestCase {
|
||||
|
||||
public static Test suite() {
|
||||
return Suite.suiteForDirectory("examples/", new Suite.SingleFileTester() {
|
||||
+1
-1
@@ -19,7 +19,7 @@ package org.jetbrains.k2js.test;
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public final class ForTest extends AbstractExpressionTest {
|
||||
public final class ForeachTest extends AbstractExpressionTest {
|
||||
|
||||
final private static String MAIN = "for/";
|
||||
|
||||
@@ -95,7 +95,7 @@ public class FunctionTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
|
||||
public void testkt921() throws Exception {
|
||||
public void testKT921() throws Exception {
|
||||
try {
|
||||
checkOutput("KT-921.kt", "");
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -22,7 +22,7 @@ package org.jetbrains.k2js.test;
|
||||
@SuppressWarnings("FieldCanBeLocal")
|
||||
public abstract class JavaClassesTest extends TranslationTest {
|
||||
|
||||
private final String SUITE = "java/";
|
||||
private static final String SUITE = "java/";
|
||||
|
||||
@Override
|
||||
protected String suiteDirectoryName() {
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.mozilla.javascript.Context;
|
||||
import org.mozilla.javascript.Scriptable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
@@ -35,12 +34,6 @@ public final class KotlinLibTest extends TranslationTest {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
private void runPropertyTypeCheck(String objectName, Map<String, Class<? extends Scriptable>> propertyToType)
|
||||
throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath()), new RhinoPropertyTypesChecker(objectName, propertyToType));
|
||||
}
|
||||
|
||||
|
||||
public void testKotlinJsLibRunsWithRhino() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath()), new RhinoResultChecker() {
|
||||
@Override
|
||||
@@ -50,68 +43,47 @@ public final class KotlinLibTest extends TranslationTest {
|
||||
});
|
||||
}
|
||||
|
||||
//TODO: refactor
|
||||
public void testCreatedTraitIsJSObject() throws Exception {
|
||||
final Map<String, Class<? extends Scriptable>> propertyToType
|
||||
= new HashMap<String, Class<? extends Scriptable>>();
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("trait.js")),
|
||||
new RhinoPropertyTypesChecker("foo", propertyToType));
|
||||
}
|
||||
|
||||
|
||||
public void testCreatedNamespaceIsJSObject() throws Exception {
|
||||
final Map<String, Class<? extends Scriptable>> propertyToType
|
||||
= new HashMap<String, Class<? extends Scriptable>>();
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("namespace.js")),
|
||||
new RhinoPropertyTypesChecker("foo", propertyToType));
|
||||
}
|
||||
|
||||
//
|
||||
// TODO:Refactor calls to function result checker with test
|
||||
public void testNamespaceHasDeclaredFunction() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("namespace.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("namespace.js");
|
||||
}
|
||||
|
||||
|
||||
public void testNamespaceHasDeclaredClasses() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("namespaceWithClasses.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("namespaceWithClasses.js");
|
||||
}
|
||||
|
||||
|
||||
public void testIsSameType() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("isSameType.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("isSameType.js");
|
||||
}
|
||||
|
||||
|
||||
public void testIsAncestorType() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("isAncestorType.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("isAncestorType.js");
|
||||
}
|
||||
|
||||
|
||||
public void testIsComplexTest() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("isComplexTest.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("isComplexTest.js");
|
||||
}
|
||||
|
||||
|
||||
public void testCommaExpression() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("commaExpression.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("commaExpression.js");
|
||||
}
|
||||
|
||||
|
||||
public void testArray() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("array.js")),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
runJavascriptTest("array.js");
|
||||
}
|
||||
|
||||
|
||||
public void testHashMap() throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases("hashMap.js")),
|
||||
runJavascriptTest("hashMap.js");
|
||||
}
|
||||
|
||||
|
||||
private void runJavascriptTest(@NotNull String filename) throws Exception {
|
||||
runRhinoTest(Arrays.asList(kotlinLibraryPath(), cases(filename)),
|
||||
new RhinoFunctionResultChecker("test", true));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
}
|
||||
|
||||
public void testIntRange() throws Exception {
|
||||
// checkOutput("intRange.kt", " ");
|
||||
checkFooBoxIsTrue("intRange.kt");
|
||||
}
|
||||
|
||||
@@ -43,4 +42,8 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
public void testSafecallComputesExpressionOnlyOnce() throws Exception {
|
||||
checkFooBoxIsTrue("safecallComputesExpressionOnlyOnce.kt");
|
||||
}
|
||||
|
||||
public void testClassWithoutNamespace() throws Exception {
|
||||
testFunctionOutput("classWithoutNamespace.kt", "Anonymous", "box", true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user