mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[kotlin][tests] AbstractKotlinProjectViewTest: add file path to output
GitOrigin-RevId: 9c4e20b0938db0fb5cbc3613164e36dc5a6369f8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6559801f14
commit
b123992da2
+27
-9
@@ -2,6 +2,7 @@
|
||||
package org.jetbrains.kotlin.idea.projectView
|
||||
|
||||
import com.intellij.ide.projectView.impl.nodes.AbstractPsiBasedNode
|
||||
import com.intellij.openapi.vfs.JarFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.projectView.TestProjectTreeStructure
|
||||
import com.intellij.psi.PsiElement
|
||||
@@ -16,8 +17,7 @@ import org.jetbrains.kotlin.idea.test.Directives
|
||||
import org.jetbrains.kotlin.idea.test.KotlinMultiFileHeavyProjectTestCase
|
||||
import java.io.File
|
||||
import javax.swing.tree.DefaultMutableTreeNode
|
||||
import kotlin.io.path.Path
|
||||
import kotlin.io.path.name
|
||||
import kotlin.io.path.*
|
||||
|
||||
abstract class AbstractKotlinProjectViewTest : KotlinMultiFileHeavyProjectTestCase() {
|
||||
private lateinit var treeStructure: TestProjectTreeStructure
|
||||
@@ -59,15 +59,32 @@ abstract class AbstractKotlinProjectViewTest : KotlinMultiFileHeavyProjectTestCa
|
||||
assertEqualsToFile(
|
||||
description = "The tree is different",
|
||||
expected = File(testDataPath.substringBeforeLast('.') + ".txt"),
|
||||
actual = "Node: $node\n" +
|
||||
"User object class: ${psiBasedNode?.let { it::class.simpleName }}\n\n" +
|
||||
"Value: ${psiBasedNode?.value}\n" +
|
||||
"Value file: ${(psiBasedNode?.value as? PsiElement)?.containingFile?.name}\n\n" +
|
||||
deepNavigation(navigationItem) + "\n\n" +
|
||||
sanitizeTree(actualTree),
|
||||
actual = sanitizeTree(
|
||||
"Node: $node\n" +
|
||||
"User object class: ${psiBasedNode?.let { it::class.simpleName }}\n\n" +
|
||||
"Value: ${psiBasedNode?.value}\n" +
|
||||
"Value file: ${filePath(psiBasedNode?.value)}\n\n" +
|
||||
deepNavigation(navigationItem) + "\n\n" +
|
||||
actualTree
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun filePath(element: Any?): String? {
|
||||
if (element !is PsiElement) return null
|
||||
|
||||
val virtualFile = element.containingFile.virtualFile
|
||||
val fileSystem = virtualFile.fileSystem
|
||||
val prefixFile = if (fileSystem is JarFileSystem) {
|
||||
fileSystem.getVirtualFileForJar(virtualFile)?.path?.let(::Path)?.parent!!
|
||||
} else {
|
||||
module.moduleNioFile.parent.listDirectoryEntries().single()
|
||||
}
|
||||
|
||||
val path = Path(virtualFile.path)
|
||||
return path.relativeTo(prefixFile).pathString
|
||||
}
|
||||
|
||||
private fun deepNavigation(element: Any?): String {
|
||||
if (element == null) return "Navigation item not found"
|
||||
return buildString {
|
||||
@@ -77,7 +94,8 @@ abstract class AbstractKotlinProjectViewTest : KotlinMultiFileHeavyProjectTestCa
|
||||
|
||||
private fun StringBuilder.deepNavigation(element: Any, count: Int) {
|
||||
appendLine("Navigation item #${count}: $element")
|
||||
appendLine("Navigation item file #${count}: ${(element as? PsiElement)?.containingFile?.name}")
|
||||
appendLine("Navigation item file #${count}: ${filePath(element)}")
|
||||
|
||||
if (element !is PsiElement) return
|
||||
val navigateElement = element.navigationElement
|
||||
if (navigateElement == element) return
|
||||
|
||||
@@ -2,10 +2,10 @@ Node: AnnotationTarget
|
||||
User object class: KtClassOrObjectTreeNode
|
||||
|
||||
Value: CLASS
|
||||
Value file: AnnotationTarget.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/annotation/AnnotationTarget.class
|
||||
|
||||
Navigation item #0: CLASS
|
||||
Navigation item file #0: AnnotationTarget.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/annotation/AnnotationTarget.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: AnnotationTarget
|
||||
User object class: KtClassOrObjectTreeNode
|
||||
|
||||
Value: CLASS
|
||||
Value file: AnnotationTarget.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/annotation/AnnotationTarget.class
|
||||
|
||||
Navigation item #0: CLASS
|
||||
Navigation item file #0: AnnotationTarget.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/annotation/AnnotationTarget.class
|
||||
Navigation item #1: CLASS
|
||||
Navigation item file #1: Annotations.kt
|
||||
Navigation item file #1: kotlin-stdlib-sources.jar!/kotlin/annotation/Annotations.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: ArraysKt__ArraysJVMKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt__ArraysJVMKt.class
|
||||
Value file: ArraysKt__ArraysJVMKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt__ArraysJVMKt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt__ArraysJVMKt.class
|
||||
Navigation item file #0: ArraysKt__ArraysJVMKt.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/collections/ArraysKt__ArraysJVMKt.class
|
||||
Navigation item #1: KtFile: ArraysKt__ArraysJVMKt.class
|
||||
Navigation item file #1: ArraysKt__ArraysJVMKt.class
|
||||
Navigation item file #1: kotlin-stdlib.jar!/kotlin/collections/ArraysKt__ArraysJVMKt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,10 +2,10 @@ Node: ArraysKt__ArraysJVMKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt__ArraysJVMKt.class
|
||||
Value file: ArraysKt__ArraysJVMKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt__ArraysJVMKt.class
|
||||
|
||||
Navigation item #0: KtFile: ArraysJVM.kt
|
||||
Navigation item file #0: ArraysJVM.kt
|
||||
Navigation item file #0: kotlin-stdlib-sources.jar!/kotlin/collections/ArraysJVM.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: ArraysKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt.class
|
||||
Value file: ArraysKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt.class
|
||||
Navigation item file #0: ArraysKt.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/collections/ArraysKt.class
|
||||
Navigation item #1: KtFile: ArraysKt.class
|
||||
Navigation item file #1: ArraysKt.class
|
||||
Navigation item file #1: kotlin-stdlib.jar!/kotlin/collections/ArraysKt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: ArraysKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt.class
|
||||
Value file: ArraysKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt.class
|
||||
Navigation item file #0: ArraysKt.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/collections/ArraysKt.class
|
||||
Navigation item #1: KtFile: ArraysKt.class
|
||||
Navigation item file #1: ArraysKt.class
|
||||
Navigation item file #1: kotlin-stdlib.jar!/kotlin/collections/ArraysKt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,10 +2,10 @@ Node: MyKotlinClass
|
||||
User object class: KtClassOrObjectTreeNode
|
||||
|
||||
Value: CLASS
|
||||
Value file: MyKotlinClass.class
|
||||
Value file: kotlinMockLibrary.jar!/MyKotlinClass.class
|
||||
|
||||
Navigation item #0: CLASS
|
||||
Navigation item file #0: MyKotlinClass.class
|
||||
Navigation item file #0: kotlinMockLibrary.jar!/MyKotlinClass.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: MyKotlinClass
|
||||
User object class: KtClassOrObjectTreeNode
|
||||
|
||||
Value: CLASS
|
||||
Value file: MyKotlinClass.class
|
||||
Value file: kotlinMockLibrary.jar!/MyKotlinClass.class
|
||||
|
||||
Navigation item #0: CLASS
|
||||
Navigation item file #0: MyKotlinClass.class
|
||||
Navigation item file #0: kotlinMockLibrary.jar!/MyKotlinClass.class
|
||||
Navigation item #1: CLASS
|
||||
Navigation item file #1: MyKotlinClass.kt
|
||||
Navigation item file #1: lib/sources/MyKotlinClass.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: MyCustomFacade__Facade1Kt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade__Facade1Kt.class
|
||||
Value file: MyCustomFacade__Facade1Kt.class
|
||||
Value file: LibraryWithFacade.jar!/one/two/MyCustomFacade__Facade1Kt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade__Facade1Kt.class
|
||||
Navigation item file #0: MyCustomFacade__Facade1Kt.class
|
||||
Navigation item file #0: LibraryWithFacade.jar!/one/two/MyCustomFacade__Facade1Kt.class
|
||||
Navigation item #1: KtFile: MyCustomFacade__Facade1Kt.class
|
||||
Navigation item file #1: MyCustomFacade__Facade1Kt.class
|
||||
Navigation item file #1: LibraryWithFacade.jar!/one/two/MyCustomFacade__Facade1Kt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ Node: MyCustomFacade__Facade1Kt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade__Facade1Kt.class
|
||||
Value file: MyCustomFacade__Facade1Kt.class
|
||||
Value file: LibraryWithFacade.jar!/one/two/MyCustomFacade__Facade1Kt.class
|
||||
|
||||
Navigation item #0: KtFile: facade1.kt
|
||||
Navigation item file #0: facade1.kt
|
||||
Navigation item file #0: lib/sources/one/facade1.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: MyCustomFacade
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Value file: MyCustomFacade.class
|
||||
Value file: LibraryWithFacade.jar!/one/two/MyCustomFacade.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Navigation item file #0: MyCustomFacade.class
|
||||
Navigation item file #0: LibraryWithFacade.jar!/one/two/MyCustomFacade.class
|
||||
Navigation item #1: KtFile: MyCustomFacade.class
|
||||
Navigation item file #1: MyCustomFacade.class
|
||||
Navigation item file #1: LibraryWithFacade.jar!/one/two/MyCustomFacade.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: MyCustomFacade
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Value file: MyCustomFacade.class
|
||||
Value file: LibraryWithFacade.jar!/one/two/MyCustomFacade.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Navigation item file #0: MyCustomFacade.class
|
||||
Navigation item file #0: LibraryWithFacade.jar!/one/two/MyCustomFacade.class
|
||||
Navigation item #1: KtFile: MyCustomFacade.class
|
||||
Navigation item file #1: MyCustomFacade.class
|
||||
Navigation item file #1: LibraryWithFacade.jar!/one/two/MyCustomFacade.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
+3
-3
@@ -2,12 +2,12 @@ Node: MyCustomFacade__FacadeKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade__FacadeKt.class
|
||||
Value file: MyCustomFacade__FacadeKt.class
|
||||
Value file: myLibraryWithFacade.jar!/MyCustomFacade__FacadeKt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade__FacadeKt.class
|
||||
Navigation item file #0: MyCustomFacade__FacadeKt.class
|
||||
Navigation item file #0: myLibraryWithFacade.jar!/MyCustomFacade__FacadeKt.class
|
||||
Navigation item #1: KtFile: MyCustomFacade__FacadeKt.class
|
||||
Navigation item file #1: MyCustomFacade__FacadeKt.class
|
||||
Navigation item file #1: myLibraryWithFacade.jar!/MyCustomFacade__FacadeKt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ Node: MyCustomFacade__FacadeKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade__FacadeKt.class
|
||||
Value file: MyCustomFacade__FacadeKt.class
|
||||
Value file: myLibraryWithFacade.jar!/MyCustomFacade__FacadeKt.class
|
||||
|
||||
Navigation item #0: KtFile: facade.kt
|
||||
Navigation item file #0: facade.kt
|
||||
Navigation item file #0: lib/sources/facade.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: MyCustomFacade
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Value file: MyCustomFacade.class
|
||||
Value file: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Navigation item file #0: MyCustomFacade.class
|
||||
Navigation item file #0: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
Navigation item #1: KtFile: MyCustomFacade.class
|
||||
Navigation item file #1: MyCustomFacade.class
|
||||
Navigation item file #1: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
+3
-3
@@ -2,12 +2,12 @@ Node: MyCustomFacade
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Value file: MyCustomFacade.class
|
||||
Value file: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Navigation item file #0: MyCustomFacade.class
|
||||
Navigation item file #0: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
Navigation item #1: KtFile: MyCustomFacade.class
|
||||
Navigation item file #1: MyCustomFacade.class
|
||||
Navigation item file #1: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ Node: MyCustomFacade
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Value file: MyCustomFacade.class
|
||||
Value file: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
|
||||
Navigation item #0: KtFile: facade.kt
|
||||
Navigation item file #0: facade.kt
|
||||
Navigation item file #0: lib/sources/facade.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@ Node: MyCustomFacade
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:MyCustomFacade.class
|
||||
Value file: MyCustomFacade.class
|
||||
Value file: myLibraryWithFacade.jar!/MyCustomFacade.class
|
||||
|
||||
Navigation item #0: KtFile: facade.kt
|
||||
Navigation item file #0: facade.kt
|
||||
Navigation item file #0: lib/sources/facade.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,10 +2,10 @@ Node: build.gradle.kts
|
||||
User object class: KtFileTreeNode
|
||||
|
||||
Value: KtFile: build.gradle.kts
|
||||
Value file: build.gradle.kts
|
||||
Value file: src/build.gradle.kts
|
||||
|
||||
Navigation item #0: KtFile: build.gradle.kts
|
||||
Navigation item file #0: build.gradle.kts
|
||||
Navigation item file #0: src/build.gradle.kts
|
||||
|
||||
|
||||
-Project
|
||||
@@ -17,4 +17,4 @@ Navigation item file #0: build.gradle.kts
|
||||
repositories
|
||||
tasks
|
||||
tasks
|
||||
+External Libraries
|
||||
+External Libraries
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: ArraysKt___ArraysKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt___ArraysKt.class
|
||||
Value file: ArraysKt___ArraysKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysKt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt___ArraysKt.class
|
||||
Navigation item file #0: ArraysKt___ArraysKt.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysKt.class
|
||||
Navigation item #1: KtFile: ArraysKt___ArraysKt.class
|
||||
Navigation item file #1: ArraysKt___ArraysKt.class
|
||||
Navigation item file #1: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysKt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,10 +2,10 @@ Node: ArraysKt___ArraysKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt___ArraysKt.class
|
||||
Value file: ArraysKt___ArraysKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysKt.class
|
||||
|
||||
Navigation item #0: KtFile: _Arrays.kt
|
||||
Navigation item file #0: _Arrays.kt
|
||||
Navigation item file #0: kotlin-stdlib-common-sources.jar!/generated/_Arrays.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,12 +2,12 @@ Node: ArraysKt___ArraysJvmKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt___ArraysJvmKt.class
|
||||
Value file: ArraysKt___ArraysJvmKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysJvmKt.class
|
||||
|
||||
Navigation item #0: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt___ArraysJvmKt.class
|
||||
Navigation item file #0: ArraysKt___ArraysJvmKt.class
|
||||
Navigation item file #0: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysJvmKt.class
|
||||
Navigation item #1: KtFile: ArraysKt___ArraysJvmKt.class
|
||||
Navigation item file #1: ArraysKt___ArraysJvmKt.class
|
||||
Navigation item file #1: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysJvmKt.class
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
@@ -2,10 +2,10 @@ Node: ArraysKt___ArraysJvmKt
|
||||
User object class: KtInternalFileTreeNode
|
||||
|
||||
Value: KtLightClassForDecompiledDeclaration of PsiFile:ArraysKt___ArraysJvmKt.class
|
||||
Value file: ArraysKt___ArraysJvmKt.class
|
||||
Value file: kotlin-stdlib.jar!/kotlin/collections/ArraysKt___ArraysJvmKt.class
|
||||
|
||||
Navigation item #0: KtFile: _ArraysJvm.kt
|
||||
Navigation item file #0: _ArraysJvm.kt
|
||||
Navigation item file #0: kotlin-stdlib-sources.jar!/generated/_ArraysJvm.kt
|
||||
|
||||
|
||||
-Project
|
||||
|
||||
Reference in New Issue
Block a user