Fix tests:
- package parts are no longer built; - test decompiled content for default file facades.
This commit is contained in:
committed by
Michael Bogdanov
parent
84649e4b26
commit
8e6054f6c7
@@ -0,0 +1,6 @@
|
||||
// IntelliJ API Decompiler stub source generated from a class file
|
||||
// Implementation of methods is not available
|
||||
|
||||
package testData.libraries
|
||||
|
||||
[public fun func(str: kotlin.String): kotlin.Unit { /* compiled code */ }]
|
||||
@@ -1,38 +1,4 @@
|
||||
// IntelliJ API Decompiler stub source generated from a class file
|
||||
// Implementation of methods is not available
|
||||
|
||||
package testData.libraries
|
||||
|
||||
[public val globalVal: testData.libraries.Pair<kotlin.Int, kotlin.String> /* compiled code */]
|
||||
|
||||
[public val globalValWithGetter: kotlin.Long /* compiled code */]
|
||||
|
||||
[public val kotlin.Int.exProp: kotlin.Int /* compiled code */]
|
||||
|
||||
[public val kotlin.String.exProp: kotlin.String /* compiled code */]
|
||||
|
||||
[public val <T> testData.libraries.Pair<T, T>.exProp: kotlin.String /* compiled code */]
|
||||
|
||||
[public fun <T : kotlin.CharSequence> funWithTypeParam(t: T): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun <T : kotlin.Number> funWithTypeParam(t: T): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(cs: kotlin.CharSequence): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(a: kotlin.Int, b: kotlin.Int): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(a: kotlin.Int, b: kotlin.String /* = compiled code */): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(str: kotlin.String): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun <T> genericFunc(): T { /* compiled code */ }]
|
||||
|
||||
[public fun main(args: kotlin.Array<kotlin.String>): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun processDouble(d: kotlin.Double): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun processDouble(d: testData.libraries.Double): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[kotlin.inline public fun <T> T.filter(predicate: (T) -> kotlin.Boolean): T? { /* compiled code */ }]
|
||||
package testData.libraries
|
||||
@@ -0,0 +1,36 @@
|
||||
// IntelliJ API Decompiler stub source generated from a class file
|
||||
// Implementation of methods is not available
|
||||
|
||||
package testData.libraries
|
||||
|
||||
[public val globalVal: testData.libraries.Pair<kotlin.Int, kotlin.String> /* compiled code */]
|
||||
|
||||
[public val globalValWithGetter: kotlin.Long /* compiled code */]
|
||||
|
||||
[public val kotlin.Int.exProp: kotlin.Int /* compiled code */]
|
||||
|
||||
[public val kotlin.String.exProp: kotlin.String /* compiled code */]
|
||||
|
||||
[public val <T> testData.libraries.Pair<T, T>.exProp: kotlin.String /* compiled code */]
|
||||
|
||||
[public fun <T : kotlin.CharSequence> funWithTypeParam(t: T): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun <T : kotlin.Number> funWithTypeParam(t: T): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(cs: kotlin.CharSequence): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(a: kotlin.Int, b: kotlin.Int): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun func(a: kotlin.Int, b: kotlin.String /* = compiled code */): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun <T> genericFunc(): T { /* compiled code */ }]
|
||||
|
||||
[public fun main(args: kotlin.Array<kotlin.String>): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun processDouble(d: kotlin.Double): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[public fun processDouble(d: testData.libraries.Double): kotlin.Unit { /* compiled code */ }]
|
||||
|
||||
[kotlin.inline public fun <T> T.filter(predicate: (T) -> kotlin.Boolean): T? { /* compiled code */ }]
|
||||
+15
@@ -30,6 +30,7 @@ import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass.Ki
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinBinaryClassCache
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.junit.Assert
|
||||
import kotlin.test.assertFalse
|
||||
|
||||
public abstract class AbstractInternalCompiledClassesTest : JetLightCodeInsightFixtureTestCase() {
|
||||
private fun isFileWithHeader(predicate: (KotlinClassHeader) -> Boolean) : VirtualFile.() -> Boolean = {
|
||||
@@ -61,6 +62,20 @@ public abstract class AbstractInternalCompiledClassesTest : JetLightCodeInsightF
|
||||
}
|
||||
}
|
||||
|
||||
protected fun doTestNoFilesAreBuiltForSyntheticClass(kind: KotlinSyntheticClass.Kind): Unit =
|
||||
doTestNoClassFilesAreBuiltFor(kind.toString(), isSyntheticClassOfKind(kind))
|
||||
|
||||
protected fun doTestNoClassFilesAreBuiltFor(fileKind: String, acceptFile: VirtualFile.() -> Boolean) {
|
||||
val root = NavigateToDecompiledLibraryTest.findTestLibraryRoot(myModule!!)!!
|
||||
val files = arrayListOf<VirtualFile>()
|
||||
root.checkRecursively {
|
||||
if (acceptFile()) {
|
||||
files.add(this)
|
||||
}
|
||||
}
|
||||
assert(files.isEmpty()) { "No class files should be built for $fileKind; found ${files.size()} files: $files" }
|
||||
}
|
||||
|
||||
protected fun doTestNoPsiFilesAreBuiltForLocalClass(kind: KotlinClass.Kind): Unit =
|
||||
doTestNoPsiFilesAreBuiltFor(kind.toString(), isClassOfKind(kind))
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.kotlin.load.java.JvmAnnotationNames.KotlinSyntheticClass.Ki
|
||||
public class InternalCompiledClassesTest : AbstractInternalCompiledClassesTest() {
|
||||
private val TEST_DATA_PATH = PluginTestCaseBase.getTestDataPathBase() + "/decompiler/internalClasses"
|
||||
|
||||
fun testPackagePartIsInvisible() = doTestNoPsiFilesAreBuiltForSyntheticClass(PACKAGE_PART)
|
||||
fun testNoPackagePartClassesAreBuilt() = doTestNoFilesAreBuiltForSyntheticClass(PACKAGE_PART)
|
||||
|
||||
fun testSamWrapperIsInvisible() = doTestNoPsiFilesAreBuiltForSyntheticClass(SAM_WRAPPER)
|
||||
|
||||
|
||||
+8
@@ -92,6 +92,14 @@ public class NavigateToDecompiledLibraryTest extends LightCodeInsightFixtureTest
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMainKt() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testExtraKt() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
classFile = getClassFile(PACKAGE, getTestName(false), myModule);
|
||||
PsiFile decompiledPsiFile = PsiManager.getInstance(getProject()).findFile(classFile);
|
||||
|
||||
Reference in New Issue
Block a user