From 8c2e61604ed1c3073d826bf56e13b62b5b4f2e22 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Tue, 12 Jul 2016 13:45:21 +0300 Subject: [PATCH] Test for "Debugger: "Step over" dives into recursive call" (KT-12924) Fixed in 7992df7b931b76d64800d89890dd50bc079049da (cherry picked from commit 78e2f05) #KT-12924 Fixed --- .../stepOverInlineFunWithRecursionCall.out | 10 +++++++++ .../stepOverInlineFunWithRecursionCall.kt | 21 +++++++++++++++++++ .../debugger/KotlinSteppingTestGenerated.java | 6 ++++++ 3 files changed, 37 insertions(+) create mode 100644 idea/testData/debugger/tinyApp/outs/stepOverInlineFunWithRecursionCall.out create mode 100644 idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlineFunWithRecursionCall.kt diff --git a/idea/testData/debugger/tinyApp/outs/stepOverInlineFunWithRecursionCall.out b/idea/testData/debugger/tinyApp/outs/stepOverInlineFunWithRecursionCall.out new file mode 100644 index 00000000000..d4118feb99e --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/stepOverInlineFunWithRecursionCall.out @@ -0,0 +1,10 @@ +LineBreakpoint created at stepOverInlineFunWithRecursionCall.kt:6 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stepOverInlineFunWithRecursionCall.StepOverInlineFunWithRecursionCallKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +stepOverInlineFunWithRecursionCall.kt:6 +stepOverInlineFunWithRecursionCall.kt:6 +stepOverInlineFunWithRecursionCall.kt:9 +stepOverInlineFunWithRecursionCall.kt:14 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlineFunWithRecursionCall.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlineFunWithRecursionCall.kt new file mode 100644 index 00000000000..b913fa68a3f --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlineFunWithRecursionCall.kt @@ -0,0 +1,21 @@ +package stepOverInlineFunWithRecursionCall + +fun foo(v: Int): Int { + if (v == 2) { + //Breakpoint! + inlineCall { foo(1) } // 1, 2 (lambda) + } + + return 2 // This line should be visited // 3 +} + + +fun main(args: Array) { + foo(2) // 4 +} + +inline fun inlineCall(l: () -> Unit) { + l() +} + +// STEP_OVER: 3 \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index f9c485df8e2..d1f32c8b32b 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -589,6 +589,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doStepOverTest(fileName); } + @TestMetadata("stepOverInlineFunWithRecursionCall.kt") + public void testStepOverInlineFunWithRecursionCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlineFunWithRecursionCall.kt"); + doStepOverTest(fileName); + } + @TestMetadata("stepOverInlineFunctionInReturn.kt") public void testStepOverInlineFunctionInReturn() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverInlineFunctionInReturn.kt");