From e25d31618c0edf430cd3bf866caf1eca0a2b4506 Mon Sep 17 00:00:00 2001 From: Sergey Mashkov Date: Tue, 24 Nov 2015 16:37:58 +0300 Subject: [PATCH] Fix tests --- .../boxWithJava/reflection/callPrivateJavaMethod/K.kt | 4 ++-- .../mapping/platformStatic/companionObjectFunction.kt | 5 ++--- .../kotlin/codegen/forTestCompile/ForTestCompileRuntime.java | 2 +- idea/testData/editor/optimizeImports/UnusedImports.kt | 2 ++ idea/testData/editor/optimizeImports/UnusedImports.kt.after | 2 +- .../navigation/NavigateToStdlibSourceRegressionTest.java | 4 ++-- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt index 5a5fb8f9dfa..83ceef92239 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt @@ -5,7 +5,7 @@ import kotlin.test.* fun box(): String { val c = J::class.constructors.single() assertFalse(c.isAccessible) - failsWith(javaClass()) { c.call("") } + assertFailsWith(javaClass()) { c.call("") } c.isAccessible = true assertTrue(c.isAccessible) @@ -13,7 +13,7 @@ fun box(): String { val m = J::class.members.single { it.name == "getResult" } assertFalse(m.isAccessible) - failsWith(javaClass()) { m.call(j)!! } + assertFailsWith(javaClass()) { m.call(j)!! } m.isAccessible = true return m.call(j) as String diff --git a/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt b/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt index 33de3fc26fd..32af776afd4 100644 --- a/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt +++ b/compiler/testData/codegen/boxWithStdlib/reflection/mapping/platformStatic/companionObjectFunction.kt @@ -1,8 +1,7 @@ import kotlin.jvm.JvmStatic as static import kotlin.reflect.KFunction import kotlin.reflect.jvm.* -import kotlin.test.assertEquals -import kotlin.test.failsWith +import kotlin.test.* class C { companion object { @@ -25,7 +24,7 @@ fun box(): String { return "Fail: no Kotlin function found for static bridge for @JvmStatic method in companion object C::foo" assertEquals(3, k2.call(C, "ghi")) - failsWith(javaClass()) { k2.call(null, "")!! } + assertFailsWith(javaClass()) { k2.call(null, "")!! } val j2 = k2.javaMethod assertEquals(j, j2) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java b/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java index f6c4c8cbb18..c299ccf0079 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/forTestCompile/ForTestCompileRuntime.java @@ -58,7 +58,7 @@ public class ForTestCompileRuntime { public static synchronized ClassLoader runtimeAndReflectJarClassLoader() { ClassLoader loader = reflectJarClassLoader.get(); if (loader == null) { - loader = createClassLoader(runtimeJarForTests(), reflectJarForTests()); + loader = createClassLoader(runtimeJarForTests(), reflectJarForTests(), kotlinTestJarForTests()); reflectJarClassLoader = new SoftReference(loader); } return loader; diff --git a/idea/testData/editor/optimizeImports/UnusedImports.kt b/idea/testData/editor/optimizeImports/UnusedImports.kt index a454695a3fa..e8f7a937745 100644 --- a/idea/testData/editor/optimizeImports/UnusedImports.kt +++ b/idea/testData/editor/optimizeImports/UnusedImports.kt @@ -6,11 +6,13 @@ import java.util.ArrayList import java.util.HashMap import kotlin.test.asserter import kotlin.test.Asserter +import kotlin.Charsets import kotlin.Assertions import kotlin.util.measureTimeMillis class Action { fun test() { + val chs = Charsets.UTF8 // val traait : Asserter = asserter val traait : Asserter? = null val objectImport : Assertions? = null diff --git a/idea/testData/editor/optimizeImports/UnusedImports.kt.after b/idea/testData/editor/optimizeImports/UnusedImports.kt.after index a5377f45aa7..53e4911b840 100644 --- a/idea/testData/editor/optimizeImports/UnusedImports.kt.after +++ b/idea/testData/editor/optimizeImports/UnusedImports.kt.after @@ -1,10 +1,10 @@ import java.util.ArrayList import java.util.HashMap -import kotlin.test.Asserter import kotlin.util.measureTimeMillis class Action { fun test() { + val chs = Charsets.UTF8 // val traait : Asserter = asserter val traait : Asserter? = null val objectImport : Assertions? = null diff --git a/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/NavigateToStdlibSourceRegressionTest.java b/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/NavigateToStdlibSourceRegressionTest.java index 0bab9f1f298..6344b8d1b09 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/NavigateToStdlibSourceRegressionTest.java +++ b/idea/tests/org/jetbrains/kotlin/idea/decompiler/navigation/NavigateToStdlibSourceRegressionTest.java @@ -27,8 +27,8 @@ public class NavigateToStdlibSourceRegressionTest extends NavigateToLibraryRegre * Regression test against KT-3186 */ public void testRefToAssertEquals() { - PsiElement navigationElement = configureAndResolve("import kotlin.test.assertEquals; val x = assertEquals(1, 2)"); - assertEquals("Test.kt", navigationElement.getContainingFile().getName()); + PsiElement navigationElement = configureAndResolve("import kotlin.io.createTempDir; val x = createTempDir()"); + assertEquals("Utils.kt", navigationElement.getContainingFile().getName()); } @Override