Skip to content

Commit ac146d5

Browse files
committed
Run TASTy reader test only on release version of Scala 3
1 parent 75f7f72 commit ac146d5

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

modules/core/src/main/scala/ch/epfl/scala/debugadapter/ScalaVersion.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ case class ScalaVersion(value: String) {
1111

1212
def binaryVersion: String = if (isScala3) "3" else if (isScala213) "2.13" else "2.12"
1313

14+
def isRelease: Boolean = !value.contains("-")
15+
1416
override def toString: String = value
1517
}
1618

modules/tests/src/test/scala/ch/epfl/scala/debugadapter/ScalaEvaluationTests.scala

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,47 @@ package ch.epfl.scala.debugadapter
33
import ch.epfl.scala.debugadapter.testfmk.*
44

55
class Scala212EvaluationTests extends Scala2EvaluationTests(ScalaVersion.`2.12`)
6-
class Scala213EvaluationTests extends Scala2EvaluationTests(ScalaVersion.`2.13`)
6+
class Scala213EvaluationTests extends Scala2EvaluationTests(ScalaVersion.`2.13`) {
7+
if (ScalaVersion.`3.1+`.isRelease) {
8+
test("should use tasty-reader") {
9+
val scala2Source =
10+
"""|package example
11+
|
12+
|trait Msg
13+
|
14+
|object Sender {
15+
| def send(msg: Msg): Unit = {
16+
| println(msg)
17+
| }
18+
|}
19+
|""".stripMargin
20+
21+
val scala2Debugee = TestingDebuggee.mainClass(scala2Source, "example.Sender", scalaVersion)
22+
val scala3Source =
23+
"""|package example
24+
|
25+
|case class Scala3Msg(msg: String) extends Msg:
26+
| override def toString: String = msg
27+
|
28+
|object Main:
29+
| def main(args: Array[String]): Unit =
30+
| Sender.send(Scala3Msg("Hello"))
31+
|""".stripMargin
32+
33+
implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(
34+
scala3Source,
35+
"example.Main",
36+
ScalaVersion.`3.1+`,
37+
Seq.empty,
38+
Seq(scala2Debugee.mainModule)
39+
)
40+
check(
41+
Breakpoint(scala2Debugee.sourceFiles.head, 7),
42+
Evaluation.success("msg.asInstanceOf[Scala3Msg].msg", "Hello")
43+
)
44+
}
45+
}
46+
}
747
class Scala30EvaluationTests extends Scala3EvaluationTests(ScalaVersion.`3.0`)
848
class Scala31PlusEvaluationTests extends Scala3EvaluationTests(ScalaVersion.`3.1+`)
949

@@ -1906,7 +1946,7 @@ abstract class ScalaEvaluationTests(scalaVersion: ScalaVersion) extends DebugTes
19061946
}
19071947
}
19081948

1909-
abstract class Scala2EvaluationTests(scalaVersion: ScalaVersion) extends ScalaEvaluationTests(scalaVersion) {
1949+
abstract class Scala2EvaluationTests(val scalaVersion: ScalaVersion) extends ScalaEvaluationTests(scalaVersion) {
19101950
test("should use -Xsource:3") {
19111951
val source =
19121952
"""|package example
@@ -1931,44 +1971,6 @@ abstract class Scala2EvaluationTests(scalaVersion: ScalaVersion) extends ScalaEv
19311971
Evaluation.success("""m(Seq("a", "b")*)""", "a, b")
19321972
)
19331973
}
1934-
1935-
test("should use tasty-reader") {
1936-
val scala2Source =
1937-
"""|package example
1938-
|
1939-
|trait Msg
1940-
|
1941-
|object Sender {
1942-
| def send(msg: Msg): Unit = {
1943-
| println(msg)
1944-
| }
1945-
|}
1946-
|""".stripMargin
1947-
1948-
val scala2Debugee = TestingDebuggee.mainClass(scala2Source, "example.Sender", scalaVersion)
1949-
val scala3Source =
1950-
"""|package example
1951-
|
1952-
|case class Scala3Msg(msg: String) extends Msg:
1953-
| override def toString: String = msg
1954-
|
1955-
|object Main:
1956-
| def main(args: Array[String]): Unit =
1957-
| Sender.send(Scala3Msg("Hello"))
1958-
|""".stripMargin
1959-
1960-
implicit val debuggee: TestingDebuggee = TestingDebuggee.mainClass(
1961-
scala3Source,
1962-
"example.Main",
1963-
ScalaVersion.`3.1+`,
1964-
Seq.empty,
1965-
Seq(scala2Debugee.mainModule)
1966-
)
1967-
check(
1968-
Breakpoint(scala2Debugee.sourceFiles.head, 7),
1969-
Evaluation.success("msg.asInstanceOf[Scala3Msg].msg", "Hello")
1970-
)
1971-
}
19721974
}
19731975

19741976
abstract class Scala3EvaluationTests(scalaVersion: ScalaVersion) extends ScalaEvaluationTests(scalaVersion) {

0 commit comments

Comments
 (0)