Refactoring tests.
This commit is contained in:
@@ -21,7 +21,7 @@ package org.jetbrains.k2js.test;
|
||||
*/
|
||||
public abstract class AbstractExpressionTest extends TranslationTest {
|
||||
|
||||
private final String SUITE = "expression/";
|
||||
private static final String SUITE = "expression/";
|
||||
|
||||
@Override
|
||||
protected String suiteDirectoryName() {
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.mozilla.javascript.JavaScriptException;
|
||||
*/
|
||||
public final class ArrayListTest extends JavaClassesTest {
|
||||
|
||||
final private static String MAIN = "arrayList/";
|
||||
private static final String MAIN = "arrayList/";
|
||||
|
||||
@Override
|
||||
protected String mainDirectory() {
|
||||
|
||||
@@ -18,7 +18,8 @@ package org.jetbrains.k2js.test;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.JetTestUtils;
|
||||
import org.jetbrains.jet.compiler.JetCoreEnvironment;
|
||||
|
||||
@@ -26,10 +27,13 @@ import org.jetbrains.jet.compiler.JetCoreEnvironment;
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
public abstract class BaseTest extends UsefulTestCase {
|
||||
@NonNls
|
||||
|
||||
@Nullable
|
||||
protected JetCoreEnvironment myEnvironment;
|
||||
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
assert myEnvironment != null : "Environment should be created beforehand.";
|
||||
return myEnvironment.getProject();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +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;
|
||||
|
||||
import org.mozilla.javascript.JavaScriptException;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
*/
|
||||
//TODO: remove class
|
||||
public class ConditionalTest extends AbstractExpressionTest {
|
||||
|
||||
final private static String MAIN = "conditional/";
|
||||
|
||||
@Override
|
||||
protected String mainDirectory() {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
public void testIfElseAsExpressionWithThrow() throws Exception {
|
||||
try {
|
||||
checkFooBoxIsTrue("ifAsExpressionWithThrow.kt");
|
||||
fail();
|
||||
} catch (JavaScriptException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.jetbrains.k2js.test;
|
||||
|
||||
import org.mozilla.javascript.JavaScriptException;
|
||||
|
||||
/**
|
||||
* @author Pavel Talanov
|
||||
* <p/>
|
||||
@@ -46,4 +48,13 @@ public final class MiscTest extends AbstractExpressionTest {
|
||||
public void testClassWithoutNamespace() throws Exception {
|
||||
testFunctionOutput("classWithoutNamespace.kt", "Anonymous", "box", true);
|
||||
}
|
||||
|
||||
public void testIfElseAsExpressionWithThrow() throws Exception {
|
||||
try {
|
||||
checkFooBoxIsTrue("ifAsExpressionWithThrow.kt");
|
||||
fail();
|
||||
} catch (JavaScriptException e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ public final class ObjectTest extends TranslationTest {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
|
||||
public void testObjectWithMethods() throws Exception {
|
||||
checkFooBoxIsTrue("objectWithMethods.kt");
|
||||
}
|
||||
|
||||
@@ -30,57 +30,47 @@ public final class PatternMatchingTest extends TranslationTest {
|
||||
return MAIN;
|
||||
}
|
||||
|
||||
|
||||
public void testWhenType() throws Exception {
|
||||
checkFooBoxIsTrue("whenType.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenNotType() throws Exception {
|
||||
checkFooBoxIsTrue("whenNotType.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenExecutesOnlyOnce() throws Exception {
|
||||
checkFooBoxIsTrue("whenExecutesOnlyOnce.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenValue() throws Exception {
|
||||
checkFooBoxIsTrue("whenValue.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenNotValue() throws Exception {
|
||||
checkFooBoxIsTrue("whenNotValue.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenValueOrType() throws Exception {
|
||||
checkFooBoxIsTrue("whenValueOrType.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenWithIf() throws Exception {
|
||||
checkFooBoxIsTrue("whenWithIf.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testMultipleCases() throws Exception {
|
||||
testFunctionOutput("multipleCases.kt", "foo", "box", 2.0);
|
||||
}
|
||||
|
||||
|
||||
public void testMatchNullableType() throws Exception {
|
||||
checkFooBoxIsTrue("matchNullableType.kt");
|
||||
}
|
||||
|
||||
|
||||
public void testWhenAsExpression() throws Exception {
|
||||
checkFooBoxIsTrue("whenAsExpression.kt");
|
||||
}
|
||||
|
||||
public void whenAsExpressionWithThrow() throws Exception {
|
||||
public void testWhenAsExpressionWithThrow() throws Exception {
|
||||
try {
|
||||
checkFooBoxIsTrue("whenAsExpressionWithThrow.kt");
|
||||
fail();
|
||||
|
||||
Reference in New Issue
Block a user