Skip to content

Commit 3900988

Browse files
committed
Run all supported tests with Scala 2 library TASTy
1 parent c88c0fe commit 3900988

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jobs:
186186
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
187187

188188
- name: Test with Scala 2 library TASTy
189-
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/testCompilation"
189+
run: ./project/scripts/sbt ";set ThisBuild/Build.useScala2LibraryTasty := true ;scala3-bootstrapped/test"
190190

191191

192192
test_windows_fast:

compiler/test/dotty/tools/dotc/semanticdb/SemanticdbTests.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import scala.jdk.CollectionConverters._
1616
import javax.tools.ToolProvider
1717

1818
import org.junit.Assert._
19+
import org.junit.Assume.assumeFalse
1920
import org.junit.Test
2021
import org.junit.experimental.categories.Category
2122

2223
import dotty.BootstrappedOnlyTests
2324
import dotty.tools.dotc.Main
2425
import dotty.tools.dotc.semanticdb.Scala3.given
2526
import dotty.tools.dotc.util.SourceFile
27+
import dotty.Properties
2628

2729
@main def updateExpect =
2830
SemanticdbTests().runExpectTest(updateExpectFiles = true)
@@ -65,6 +67,7 @@ class SemanticdbTests:
6567
@Test def expectTests: Unit = if (!scala.util.Properties.isWin) runExpectTest(updateExpectFiles = false)
6668

6769
def runExpectTest(updateExpectFiles: Boolean): Unit =
70+
assumeFalse("dotty/tests/semanticdb/metac.expect differs when using Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
6871
val target = generateSemanticdb()
6972
val errors = mutable.ArrayBuffer.empty[Path]
7073
val metacSb: StringBuilder = StringBuilder(5000)

compiler/test/dotty/tools/scripting/BashScriptsTests.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import scala.language.unsafeNulls
77
import java.nio.file.Paths
88
import org.junit.{Test, AfterClass}
99
import org.junit.Assert.assertEquals
10+
import org.junit.Assume.assumeFalse
1011
import org.junit.experimental.categories.Category
1112

1213
import vulpix.TestConfiguration
@@ -84,30 +85,35 @@ class BashScriptsTests:
8485

8586
/* verify that `dist/bin/scala` correctly passes args to the jvm via -J-D for script envtest.sc */
8687
@Test def verifyScJProperty =
88+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
8789
val tag = "World1"
8890
val stdout = callScript(tag, envtestSc, s"-J-Dkey")
8991
assertEquals( s"Hello $tag", stdout)
9092

9193
/* verify that `dist/bin/scala` correctly passes args to the jvm via -J-D for script envtest.scala */
9294
@Test def verifyScalaJProperty =
95+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
9396
val tag = "World2"
9497
val stdout = callScript(tag, envtestScala, s"-J-Dkey")
9598
assertEquals(s"Hello $tag", stdout)
9699

97100
/* verify that `dist/bin/scala` can set system properties via -D for envtest.sc */
98101
@Test def verifyScDProperty =
102+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
99103
val tag = "World3"
100104
val stdout = callScript(tag, envtestSc, s"-Dkey")
101105
assertEquals(s"Hello $tag", stdout)
102106

103107
/* verify that `dist/bin/scala` can set system properties via -D for envtest.scala */
104108
@Test def verifyScalaDProperty =
109+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
105110
val tag = "World4"
106111
val stdout = callScript(tag, envtestScala, s"-Dkey")
107112
assertEquals(s"Hello $tag", stdout)
108113

109114
/* verify that `dist/bin/scala` can set system properties via -D when executing compiled script via -jar envtest.jar */
110115
@Test def saveAndRunWithDProperty =
116+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
111117
val commandline = Seq("SCALA_OPTS= ", scalaPath.relpath, "-save", envtestScala.relpath).mkString(" ")
112118
val (_, _, _, _) = bashCommand(commandline) // compile jar, discard output
113119
val testJar = testFile("envtest.jar") // jar is created by the previous bashCommand()
@@ -125,6 +131,7 @@ class BashScriptsTests:
125131

126132
/* verify `dist/bin/scalac` non-interference with command line args following script name */
127133
@Test def verifyScalacArgs =
134+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
128135
val commandline = (Seq("SCALA_OPTS= ", scalacPath, "-script", showArgsScript) ++ testScriptArgs).mkString(" ")
129136
val (validTest, exitCode, stdout, stderr) = bashCommand(commandline)
130137
if verifyValid(validTest) then
@@ -140,6 +147,7 @@ class BashScriptsTests:
140147

141148
/* verify `dist/bin/scala` non-interference with command line args following script name */
142149
@Test def verifyScalaArgs =
150+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
143151
val commandline = (Seq("SCALA_OPTS= ", scalaPath, showArgsScript) ++ testScriptArgs).mkString(" ")
144152
val (validTest, exitCode, stdout, stderr) = bashCommand(commandline)
145153
if verifyValid(validTest) then
@@ -159,6 +167,7 @@ class BashScriptsTests:
159167
*/
160168
@Category(Array(classOf[BootstrappedOnlyTests]))
161169
@Test def verifyScriptPathProperty =
170+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
162171
val scriptFile = testFiles.find(_.getName == "scriptPath.sc").get
163172
val expected = s"${scriptFile.getName}"
164173
printf("===> verify valid system property script.path is reported by script [%s]\n", scriptFile.getName)
@@ -175,6 +184,7 @@ class BashScriptsTests:
175184
* verify SCALA_OPTS can specify an @argsfile when launching a scala script in `dist/bin/scala`.
176185
*/
177186
@Test def verifyScalaOpts =
187+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
178188
val scriptFile = testFiles.find(_.getName == "classpathReport.sc").get
179189
printf("===> verify SCALA_OPTS='@argsfile' is properly handled by `dist/bin/scala`\n")
180190
val envPairs = List(("SCALA_OPTS", s"@$argsfile"))
@@ -197,6 +207,7 @@ class BashScriptsTests:
197207
* verify that individual scripts can override -save with -nosave (needed to address #13760).
198208
*/
199209
@Test def sqlDateTest =
210+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
200211
val scriptBase = "sqlDateError"
201212
val scriptFile = testFiles.find(_.getName == s"$scriptBase.sc").get
202213
val testJar = testFile(s"$scriptBase.jar") // jar should not be created when scriptFile runs
@@ -221,6 +232,7 @@ class BashScriptsTests:
221232
* verify -e println("yo!") works.
222233
*/
223234
@Test def verifyCommandLineExpression =
235+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
224236
printf("===> verify -e <expression> is properly handled by `dist/bin/scala`\n")
225237
val expected = "9"
226238
val expression = s"println(3*3)"

compiler/test/dotty/tools/scripting/ExpressionTest.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import scala.language.unsafeNulls
77
import java.nio.file.Paths
88
import org.junit.{Test, AfterClass}
99
import org.junit.Assert.assertEquals
10+
import org.junit.Assume.assumeFalse
1011
import org.junit.experimental.categories.Category
1112

1213
import vulpix.TestConfiguration
@@ -22,13 +23,15 @@ class ExpressionTest:
2223
* verify -e <expression> works.
2324
*/
2425
@Test def verifyCommandLineExpression =
26+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
2527
printf("===> verify -e <expression> is properly handled by `dist/bin/scala`\n")
2628
val expected = "9"
2729
val expression = s"println(3*3)"
2830
val result = getResult(expression)
29-
assert(result.contains(expected), s"expression [$expression] did not send [$expected] to stdout")
31+
assert(result.contains(expected), s"expression [$expression] did not send [$expected] to stdout. It send [$result].")
3032

3133
@Test def verifyImports: Unit =
34+
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
3235
val expressionLines = List(
3336
"import java.nio.file.Paths",
3437
"import scala.util.Properties.userDir",

0 commit comments

Comments
 (0)