Files
openide/plugins/kotlin/jvm-debugger/test
Vladimir Lagunov 1d8ca26477 Update copyrights in Kotlin Tests to let Test Aggregator pass
Otherwise, `org.jetbrains.kotlin.idea.testGenerator.all.AllTestsGeneratedTest.testAllTestsIsUpToDate` fails with an error like:

```
com.intellij.platform.testFramework.core.FileComparisonFailedError: 'GradleBuildFileHighlightingTestGenerated.java' is not up to date
Use 'Generate Kotlin Tests' run configuration to regenerate tests
  at org.jetbrains.kotlin.testGenerator.generator.TestGeneratorKt.write(TestGenerator.kt:156)
  at org.jetbrains.kotlin.testGenerator.generator.TestGenerator.write(TestGenerator.kt:72)
  at org.jetbrains.kotlin.testGenerator.generator.TestGenerator.write(TestGenerator.kt:32)
  at org.jetbrains.kotlin.fe10.testGenerator.Fe10GenerateTestsKt.generateK1Tests(Fe10GenerateTests.kt:172)
  at org.jetbrains.kotlin.idea.testGenerator.all.AllTestsGeneratedTest.testAllTestsIsUpToDate(AllTestsGeneratedTest.kt:10)
  at java.base/java.lang.reflect.Method.invoke(Method.java:580)
  at junit.framework.TestCase.runTest(TestCase.java:177)
  at junit.framework.TestCase.runBare(TestCase.java:142)
  at junit.framework.TestResult$1.protect(TestResult.java:122)
  at junit.framework.TestResult.runProtected(TestResult.java:142)
  at junit.framework.TestResult.run(TestResult.java:125)
  at junit.framework.TestCase.run(TestCase.java:130)
  at junit.framework.TestSuite.runTest(TestSuite.java:241)
  at junit.framework.TestSuite.run(TestSuite.java:236)
  at com.intellij.TestAll.runOrCollectNextTest(TestAll.java:399)
  at com.intellij.TestAll.run(TestAll.java:280)
  at junit.framework.TestSuite.runTest(TestSuite.java:241)
  at junit.framework.TestSuite.run(TestSuite.java:236)
```

GitOrigin-RevId: c8a0adce00acd8196ac923bf62425f682be70931
2025-01-02 17:06:48 +00:00
..

Kotlin debugger tests

This module contains generated tests for Kotlin debugger. Tests design lets one add debugger markup directly in a code sample. For example, breakpoint installation is done with //Breakpoint! marker on the line previous to the target one.

Tests are separated into different categories depending on tested functionality, e.g. stepping, evaluation, smart-step-into targets, local variables, highlighting, etc.

To create a new test:

  1. Choose the target functionality to test and the corresponding subdirectory inside testData folder
  2. Create a <FILE_NAME>.kt file with the code sample to test
  3. Add the markup specific for the target functionality. Check the available capabilities in the nearby files.
  4. Create a <FILE_NAME>.out file with the expected output. Check the expected output format in the nearby files.
  5. Start Generate Kotlin Tests (K1 + K2) run configuration

Markup

Stepping

  1. //Breakpoint! installs a breakpoint to the next line. Breakpoint can be configured further:
    1. lambdaOrdinal=N -- breakpoint to the Nth lambda
      1. lambdaOrdinal=-1 -- basic line breakpoint (no suspension in lambdas)
    2. condition=<EXPRESSION> -- conditional breakpoints
    3. See all capabilities in BreakpointCreator.kt
  2. Stepping commands are executed on suspension points. The commands are executed in the order they appear in the file.
    1. Basic stepping commands can be called several times: // <COMMAND>: N
      1. RESUME, STEP_INTO, STEP_OVER, STEP_OUT
    2. Smart step into // SMART_STEP_INTO_BY_INDEX: N steps into Nth stepping target
    3. See all commands in SteppingInstruction.kt

Evaluation

Evaluation commands are executed in the order they appear in the file.

  1. Expression to evaluate is stated via // EXPRESSION: <EXPR> command
  2. The expected results should follow the expression // RESULT: <RES>: <TYPE>
  3. See AbstractIrKotlinEvaluateExpressionTest.kt for details

Adding libraries to the classpath

Use // ATTACH_LIBRARY: maven(<LIB>) to add a library to the classpath.

For example, // ATTACH_LIBRARY: maven(org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4) adds coroutines

Multifile

Use // FILE: <FILE_NAME> directive to split a file into several files. You can use Kotlin or Java files.