Skip to content

Commit

Permalink
[debugger, tests] Add a test case for a breakpoint on a whole line in…
Browse files Browse the repository at this point in the history
… a multi-line lambda expression with a one-line lambda on the same line #SCL-23461
  • Loading branch information
vasilmkd committed Jan 20, 2025
1 parent b45d6c1 commit 3add445
Showing 1 changed file with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ class LambdaBreakpointsTest_2_12 extends LambdaBreakpointsTestBase {
(4, "$anonfun$fooInTrait$1"), (4, "$anonfun$fooInTrait$1"), (5, "fooInTrait")
)
}

override def testLineInLambdaWithLambdaOnLineInTrait(): Unit = {
breakpointsTest()(
(5, "$anonfun$fooInTrait$1"), (6, "$anonfun$fooInTrait$1"), (6, "$anonfun$fooInTrait$2"),
(5, "$anonfun$fooInTrait$1"), (6, "$anonfun$fooInTrait$1"), (6, "$anonfun$fooInTrait$2"),
(8, "fooInTrait")
)
}
}

class LambdaBreakpointsTest_2_13 extends LambdaBreakpointsTest_2_12 {
Expand Down Expand Up @@ -270,6 +278,14 @@ class LambdaBreakpointsTest_3_3 extends LambdaBreakpointsTestBase {
(4, "$anonfun$1"), (4, "$anonfun$1"), (5, "fooInTrait")
)
}

override def testLineInLambdaWithLambdaOnLineInTrait(): Unit = {
breakpointsTest()(
(5, "$anonfun$1"), (6, "$anonfun$1"), (6, "$anonfun$1$$anonfun$1"),
(5, "$anonfun$1"), (6, "$anonfun$1"), (6, "$anonfun$1$$anonfun$1"),
(8, "fooInTrait")
)
}
}

class LambdaBreakpointsTest_3_4 extends LambdaBreakpointsTest_3_3 {
Expand Down Expand Up @@ -351,6 +367,15 @@ class LambdaBreakpointsTest_3_4 extends LambdaBreakpointsTest_3_3 {
(11, "$anonfun$1"), (12, "$anonfun$1"), (11, "$anonfun$1"), (12, "$anonfun$1"), (14, "fooFromMain"),
)
}

override def testLineInLambdaWithLambdaOnLineInTrait(): Unit = {
breakpointsTest()(
(6, "fooInTrait"),
(5, "$anonfun$1"), (6, "$anonfun$1"), (6, "$anonfun$1$$anonfun$1"),
(5, "$anonfun$1"), (6, "$anonfun$1"), (6, "$anonfun$1$$anonfun$1"),
(8, "fooInTrait")
)
}
}

class LambdaBreakpointsTest_3_5 extends LambdaBreakpointsTest_3_3 {
Expand Down Expand Up @@ -738,5 +763,33 @@ abstract class LambdaBreakpointsTestBase extends ScalaDebuggerTestCase {
(4, "apply$mcII$sp"), (4, "apply$mcII$sp"), (5, "fooInTrait")
)
}

addSourceFile("LineInLambdaWithLambdaOnLineInTrait.scala",
s"""
|trait MyTraitWithLambdaWithLambdaOnLine {
| def fooInTrait(): Unit = {
| val seq = 1 to 2
| val seqNew = seq.flatMap { item =>
| val x = 1 + 1 $breakpoint
| Seq(item).map(_ + x) $breakpoint
| }
| println(seqNew) $breakpoint
| }
|}
|
|object LineInLambdaWithLambdaOnLineInTrait extends MyTraitWithLambdaWithLambdaOnLine {
| def main(args: Array[String]): Unit = {
| fooInTrait()
| }
|}
|""".stripMargin)

def testLineInLambdaWithLambdaOnLineInTrait(): Unit = {
breakpointsTest()(
(5, "apply"), (6, "apply"), (6, "apply$mcII$sp"),
(5, "apply"), (6, "apply"), (6, "apply$mcII$sp"),
(8, "fooInTrait")
)
}
}

0 comments on commit 3add445

Please sign in to comment.