diff --git a/js/js.tests/test/org/jetbrains/k2js/test/AbstractExpressionTest.java b/js/js.tests/test/org/jetbrains/k2js/test/AbstractExpressionTest.java index 95f3eb9bbb0..b4770f1177c 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/AbstractExpressionTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/AbstractExpressionTest.java @@ -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() { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/ArrayListTest.java b/js/js.tests/test/org/jetbrains/k2js/test/ArrayListTest.java index 85d4a4706cc..9ce795dcee1 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/ArrayListTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/ArrayListTest.java @@ -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() { diff --git a/js/js.tests/test/org/jetbrains/k2js/test/BaseTest.java b/js/js.tests/test/org/jetbrains/k2js/test/BaseTest.java index 1862a52d6e4..e624a8f9f4b 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/BaseTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/BaseTest.java @@ -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(); } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/ConditionalTest.java b/js/js.tests/test/org/jetbrains/k2js/test/ConditionalTest.java deleted file mode 100644 index 01bc150435f..00000000000 --- a/js/js.tests/test/org/jetbrains/k2js/test/ConditionalTest.java +++ /dev/null @@ -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) { - - } - } -} diff --git a/js/js.tests/test/org/jetbrains/k2js/test/MiscTest.java b/js/js.tests/test/org/jetbrains/k2js/test/MiscTest.java index 84fa84dc51f..39eb7ab2391 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/MiscTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/MiscTest.java @@ -16,6 +16,8 @@ package org.jetbrains.k2js.test; +import org.mozilla.javascript.JavaScriptException; + /** * @author Pavel Talanov *

@@ -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) { + + } + } } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/ObjectTest.java b/js/js.tests/test/org/jetbrains/k2js/test/ObjectTest.java index c40cebca8fa..1b1a1f604c8 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/ObjectTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/ObjectTest.java @@ -28,7 +28,6 @@ public final class ObjectTest extends TranslationTest { return MAIN; } - public void testObjectWithMethods() throws Exception { checkFooBoxIsTrue("objectWithMethods.kt"); } diff --git a/js/js.tests/test/org/jetbrains/k2js/test/PatternMatchingTest.java b/js/js.tests/test/org/jetbrains/k2js/test/PatternMatchingTest.java index 7bb03d3fd06..1cbfc010a22 100644 --- a/js/js.tests/test/org/jetbrains/k2js/test/PatternMatchingTest.java +++ b/js/js.tests/test/org/jetbrains/k2js/test/PatternMatchingTest.java @@ -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(); diff --git a/js/js.translator/testFiles/expression/conditional/cases/ifAsExpressionWithThrow.kt b/js/js.translator/testFiles/expression/misc/cases/ifAsExpressionWithThrow.kt similarity index 100% rename from js/js.translator/testFiles/expression/conditional/cases/ifAsExpressionWithThrow.kt rename to js/js.translator/testFiles/expression/misc/cases/ifAsExpressionWithThrow.kt