IDEA: add a couple "navigate to inline function call site" tests
This commit is contained in:
@@ -53,6 +53,12 @@ class InlineFunctionHyperLinkInfo(
|
||||
return file?.let { OpenFileDescriptor(project, file.file, file.line, 0) }
|
||||
}
|
||||
|
||||
val callSiteDescriptor: OpenFileDescriptor?
|
||||
get() {
|
||||
val file = inlineInfo.firstOrNull { it is InlineInfo.CallSiteInfo }
|
||||
return file?.let { OpenFileDescriptor(project, file.file, file.line, 0) }
|
||||
}
|
||||
|
||||
sealed class InlineInfo(val prefix: String, val file: VirtualFile, val line: Int) {
|
||||
class CallSiteInfo(file: VirtualFile, line: Int) :
|
||||
InlineInfo(KotlinBundle.message("filters.text.inline.function.call.site"), file, line)
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun box() {
|
||||
foo()
|
||||
}
|
||||
|
||||
inline fun foo() {
|
||||
null!!
|
||||
}
|
||||
|
||||
// NAVIGATE_TO_CALL_SITE
|
||||
// FILE: inlineFunCallSite.kt
|
||||
// LINE: 2
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun box() {
|
||||
bar {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun foo() {
|
||||
null!!
|
||||
}
|
||||
|
||||
inline fun bar(x: () -> Unit) {
|
||||
x()
|
||||
}
|
||||
|
||||
// NAVIGATE_TO_CALL_SITE
|
||||
// FILE: inlineFunCallSiteInInlineLambda.kt
|
||||
// LINE: 3
|
||||
@@ -110,7 +110,11 @@ abstract class AbstractKotlinExceptionFilterTest : KotlinCodeInsightTestCase() {
|
||||
}
|
||||
|
||||
val info = result.firstHyperlinkInfo as FileHyperlinkInfo
|
||||
val descriptor = info.descriptor!!
|
||||
val descriptor = if (InTextDirectivesUtils.isDirectiveDefined(fileText, "NAVIGATE_TO_CALL_SITE"))
|
||||
(info as? InlineFunctionHyperLinkInfo)?.callSiteDescriptor
|
||||
?: throw AssertionError("`$stackTraceString` did not resolve to an inline function call")
|
||||
else
|
||||
info.descriptor!!
|
||||
|
||||
val expectedFileName = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// FILE: ")!!
|
||||
val expectedVirtualFile = File(rootDir, expectedFileName).toVirtualFile()
|
||||
|
||||
+10
@@ -38,6 +38,16 @@ public class KotlinExceptionFilterTestGenerated extends AbstractKotlinExceptionF
|
||||
runTest("idea/testData/debugger/exceptionFilter/inlineFunCallInLibrary/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunCallSite")
|
||||
public void testInlineFunCallSite() throws Exception {
|
||||
runTest("idea/testData/debugger/exceptionFilter/inlineFunCallSite/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunCallSiteInInlineLambda")
|
||||
public void testInlineFunCallSiteInInlineLambda() throws Exception {
|
||||
runTest("idea/testData/debugger/exceptionFilter/inlineFunCallSiteInInlineLambda/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineFunFromLibrary")
|
||||
public void testInlineFunFromLibrary() throws Exception {
|
||||
runTest("idea/testData/debugger/exceptionFilter/inlineFunFromLibrary/");
|
||||
|
||||
Reference in New Issue
Block a user