From 90ce15d96f9753ea1d2db3c4c89d7e2a98b4ac32 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Mon, 1 Oct 2012 16:14:40 +0400 Subject: [PATCH] Modify test for KT-1515 to actually test using javaClass in another package as stated in the request. NOTE: not 100% that this test actually covers the corresponding fix by Alex Tkachman. --- .../codegen/multi/kt1515/otherPackage.kt | 6 ++++++ .../codegen/multi/kt1515/thisPackage.kt | 18 ++++++++++++++++++ .../testData/codegen/regressions/kt1515.kt | 4 ---- .../jet/codegen/MultiFileGenTest.java | 6 +++++- .../org/jetbrains/jet/codegen/StdlibTest.java | 4 ---- 5 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 compiler/testData/codegen/multi/kt1515/otherPackage.kt create mode 100644 compiler/testData/codegen/multi/kt1515/thisPackage.kt delete mode 100644 compiler/testData/codegen/regressions/kt1515.kt diff --git a/compiler/testData/codegen/multi/kt1515/otherPackage.kt b/compiler/testData/codegen/multi/kt1515/otherPackage.kt new file mode 100644 index 00000000000..0951030fcbb --- /dev/null +++ b/compiler/testData/codegen/multi/kt1515/otherPackage.kt @@ -0,0 +1,6 @@ +package otherpackage + +fun fromOtherPackage(): Boolean { + val c = javaClass() + return (c.getName()!! == "java.lang.Runnable") +} \ No newline at end of file diff --git a/compiler/testData/codegen/multi/kt1515/thisPackage.kt b/compiler/testData/codegen/multi/kt1515/thisPackage.kt new file mode 100644 index 00000000000..dbd4a897a1b --- /dev/null +++ b/compiler/testData/codegen/multi/kt1515/thisPackage.kt @@ -0,0 +1,18 @@ +package thispackage + +import otherpackage.* + +fun box(): String { + if (!localUse()) { + return "local use failed" + } + if (!fromOtherPackage()) { + return "use from other package failed" + } + return "OK" +} + +fun localUse(): Boolean { + val c = javaClass() + return (c.getName()!! == "java.lang.Runnable") +} \ No newline at end of file diff --git a/compiler/testData/codegen/regressions/kt1515.kt b/compiler/testData/codegen/regressions/kt1515.kt deleted file mode 100644 index 0cc0dcba2ed..00000000000 --- a/compiler/testData/codegen/regressions/kt1515.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - val c = javaClass() - return if(c.getName()!! == "java.lang.Runnable") "OK" else "fail" -} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/jet/codegen/MultiFileGenTest.java b/compiler/tests/org/jetbrains/jet/codegen/MultiFileGenTest.java index 52477122f32..ef12348ed0c 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/MultiFileGenTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/MultiFileGenTest.java @@ -22,7 +22,7 @@ public class MultiFileGenTest extends CodegenTestCase { @Override protected void setUp() throws Exception { super.setUp(); - createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.JDK_ONLY); + createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.ALL); } public void testSimple() { @@ -41,4 +41,8 @@ public class MultiFileGenTest extends CodegenTestCase { public void testSameNames() { blackBoxMultiFile("/multi/same/1/box.kt", "/multi/same/2/box.kt"); } + + public void testKt1515() { + blackBoxMultiFile("/multi/kt1515/thisPackage.kt", "/multi/kt1515/otherPackage.kt"); + } } diff --git a/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java b/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java index 5683b341d58..76ee8378aea 100644 --- a/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java +++ b/compiler/tests/org/jetbrains/jet/codegen/StdlibTest.java @@ -147,10 +147,6 @@ public class StdlibTest extends CodegenTestCase { blackBoxFile("regressions/kt1568.kt"); } - public void testKt1515() throws Exception { - blackBoxFile("regressions/kt1515.kt"); - } - public void testKt1592 () throws MalformedURLException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { loadFile("regressions/kt1592.kt"); ClassFileFactory codegens = generateClassesInFile();