From 95b9c051381848f767772cfc99f6122ca672528f Mon Sep 17 00:00:00 2001 From: Natalia Ukhorskaya Date: Tue, 19 May 2015 15:41:13 +0300 Subject: [PATCH] Tests for step out command --- .../kotlin/generators/tests/GenerateTests.kt | 1 + .../tinyApp/outs/allFilesPresentInStepOut.out | 0 .../idea/debugger/AbstractKotlinSteppingTest.kt | 15 +++++++++++++++ .../idea/debugger/KotlinDebuggerTestBase.kt | 4 ++++ 4 files changed, 20 insertions(+) create mode 100644 idea/testData/debugger/tinyApp/outs/allFilesPresentInStepOut.out diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index cf3033fbbb8..804830856b0 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -610,6 +610,7 @@ fun main(args: Array) { model("debugger/tinyApp/src/stepInto/stepIntoAndSmartStepInto", testMethod = "doStepIntoTest", testClassName = "StepInto") model("debugger/tinyApp/src/stepInto/stepIntoAndSmartStepInto", testMethod = "doSmartStepIntoTest", testClassName = "SmartStepInto") model("debugger/tinyApp/src/stepInto/stepInto", testMethod = "doStepIntoTest", testClassName = "StepIntoOnly") + model("debugger/tinyApp/src/stepOut", testMethod = "doStepOutTest") model("debugger/tinyApp/src/filters", testMethod = "doStepIntoTest") } diff --git a/idea/testData/debugger/tinyApp/outs/allFilesPresentInStepOut.out b/idea/testData/debugger/tinyApp/outs/allFilesPresentInStepOut.out new file mode 100644 index 00000000000..e69de29bb2d diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt index e42d2fdd8e7..2e9912c327f 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/AbstractKotlinSteppingTest.kt @@ -46,6 +46,21 @@ public abstract class AbstractKotlinSteppingTest : KotlinDebuggerTestBase() { finish() } + protected fun doStepOutTest(path: String) { + val fileText = FileUtil.loadFile(File(path)) + + configureSettings(fileText) + + createDebugProcess(path) + val count = findStringWithPrefixes(fileText, "// STEP_OUT: ")?.toInt() ?: 1 + + for (i in 1..count) { + onBreakpoint { stepOut() } + } + + finish() + } + protected fun doSmartStepIntoTest(path: String) { createDebugProcess(path) onBreakpoint { smartStepInto() } diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt index 19ecc6a39d5..7ec63154a91 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerTestBase.kt @@ -115,6 +115,10 @@ abstract class KotlinDebuggerTestBase : KotlinDebuggerTestCase() { dp.getManagerThread()!!.schedule(dp.createStepIntoCommand(this, ignoreFilters, smartStepFilter)) } + protected fun SuspendContextImpl.stepOut() { + dp.getManagerThread()!!.schedule(dp.createStepOutCommand(this)) + } + protected fun SuspendContextImpl.printContext() { runReadAction { if (this.getFrameProxy() == null) {