Skip to content

Commit c2da473

Browse files
committed
Enable more tests
1 parent 07fb38d commit c2da473

File tree

5 files changed

+7
-22
lines changed

5 files changed

+7
-22
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import scala.language.unsafeNulls
77
import java.nio.file.Files, java.nio.charset.StandardCharsets.UTF_8
88
import org.junit.{ After, Test }
99
import org.junit.Assert.assertEquals
10-
import org.junit.Assume.assumeFalse
1110
import org.junit.experimental.categories.Category
1211

1312
import ScriptTestEnv.*
@@ -20,7 +19,6 @@ class BashExitCodeTests:
2019

2120
/** Verify the exit code of running `cmd args*`. */
2221
def verifyExit(cmd: String, args: String*)(expectedExitCode: Int): Unit =
23-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
2422
val (validTest, exitCode, stdout, stderr) = bashCommand((cmd +: args).mkString(" "))
2523
if verifyValid(validTest) then
2624
assertEquals({

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,30 @@ class BashScriptsTests:
8585

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

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

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

107104
/* verify that `dist/bin/scala` can set system properties via -D for envtest.scala */
108105
@Test def verifyScalaDProperty =
109-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
110106
val tag = "World4"
111107
val stdout = callScript(tag, envtestScala, s"-Dkey")
112108
assertEquals(s"Hello $tag", stdout)
113109

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

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

148142
/* verify `dist/bin/scala` non-interference with command line args following script name */
149143
@Test def verifyScalaArgs =
150-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
151144
val commandline = (Seq("SCALA_OPTS= ", scalaPath, showArgsScript) ++ testScriptArgs).mkString(" ")
152145
val (validTest, exitCode, stdout, stderr) = bashCommand(commandline)
153146
if verifyValid(validTest) then
@@ -167,7 +160,7 @@ class BashScriptsTests:
167160
*/
168161
@Category(Array(classOf[BootstrappedOnlyTests]))
169162
@Test def verifyScriptPathProperty =
170-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
163+
assumeFalse("Scripts do not yet support fully Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
171164
val scriptFile = testFiles.find(_.getName == "scriptPath.sc").get
172165
val expected = s"${scriptFile.getName}"
173166
printf("===> verify valid system property script.path is reported by script [%s]\n", scriptFile.getName)
@@ -184,7 +177,7 @@ class BashScriptsTests:
184177
* verify SCALA_OPTS can specify an @argsfile when launching a scala script in `dist/bin/scala`.
185178
*/
186179
@Test def verifyScalaOpts =
187-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
180+
assumeFalse("Scripts do not yet support fully Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
188181
val scriptFile = testFiles.find(_.getName == "classpathReport.sc").get
189182
printf("===> verify SCALA_OPTS='@argsfile' is properly handled by `dist/bin/scala`\n")
190183
val envPairs = List(("SCALA_OPTS", s"@$argsfile"))
@@ -207,7 +200,7 @@ class BashScriptsTests:
207200
* verify that individual scripts can override -save with -nosave (needed to address #13760).
208201
*/
209202
@Test def sqlDateTest =
210-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
203+
assumeFalse("Scripts do not yet support fully Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
211204
val scriptBase = "sqlDateError"
212205
val scriptFile = testFiles.find(_.getName == s"$scriptBase.sc").get
213206
val testJar = testFile(s"$scriptBase.jar") // jar should not be created when scriptFile runs
@@ -232,7 +225,6 @@ class BashScriptsTests:
232225
* verify -e println("yo!") works.
233226
*/
234227
@Test def verifyCommandLineExpression =
235-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
236228
printf("===> verify -e <expression> is properly handled by `dist/bin/scala`\n")
237229
val expected = "9"
238230
val expression = s"println(3*3)"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import java.io.File
88
import java.nio.file.Path
99

1010
import org.junit.{Test, Ignore, AfterClass}
11+
import org.junit.Assume.assumeFalse
1112
import vulpix.TestConfiguration
1213
import ScriptTestEnv.*
1314

@@ -78,6 +79,7 @@ class ClasspathTests:
7879
* verify classpath is unglobbed by MainGenericRunner.
7980
*/
8081
@Test def unglobClasspathVerifyTest = {
82+
assumeFalse("Scripts do not yet support fully Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
8183
val testScriptName = "unglobClasspath.sc"
8284
val testScript = scripts("/scripting").find { _.name.matches(testScriptName) } match
8385
case None => sys.error(s"test script not found: ${testScriptName}")

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ class ExpressionTest:
2323
* verify -e <expression> works.
2424
*/
2525
@Test def verifyCommandLineExpression =
26-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
26+
assumeFalse("Scripts do not yet support fully Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
2727
printf("===> verify -e <expression> is properly handled by `dist/bin/scala`\n")
2828
val expected = "9"
2929
val expression = s"println(3*3)"
3030
val result = getResult(expression)
3131
assert(result.contains(expected), s"expression [$expression] did not send [$expected] to stdout. It send [$result].")
3232

3333
@Test def verifyImports: Unit =
34-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
34+
assumeFalse("Scripts do not yet support fully Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
3535
val expressionLines = List(
3636
"import java.nio.file.Paths",
3737
"import scala.util.Properties.userDir",

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import org.junit.Test
1212
import vulpix.TestConfiguration
1313
import ScriptTestEnv.*
1414

15-
import org.junit.Assume.assumeFalse
16-
1715
/** Runs all tests contained in `compiler/test-resources/scripting/` */
1816
class ScriptingTests:
1917
// classpath tests managed by scripting.ClasspathTests.scala
@@ -23,7 +21,6 @@ class ScriptingTests:
2321
* Call .scala scripts without -save option, verify no jar created
2422
*/
2523
@Test def scriptingDriverTests =
26-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
2724
for (scriptFile, scriptArgs) <- scalaFilesWithArgs(".scala") do
2825
showScriptUnderTest(scriptFile)
2926
val unexpectedJar = script2jar(scriptFile)
@@ -46,7 +43,6 @@ class ScriptingTests:
4643
* Call .sc scripts without -save option, verify no jar created
4744
*/
4845
@Test def scriptingMainTests =
49-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
5046
for (scriptFile, scriptArgs) <- scalaFilesWithArgs(".sc") do
5147
showScriptUnderTest(scriptFile)
5248
val unexpectedJar = script2jar(scriptFile)
@@ -65,7 +61,6 @@ class ScriptingTests:
6561
* Call .sc scripts with -save option, verify jar is created.
6662
*/
6763
@Test def scriptingJarTest =
68-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
6964
for (scriptFile, scriptArgs) <- scalaFilesWithArgs(".sc") do
7065
showScriptUnderTest(scriptFile)
7166
val expectedJar = script2jar(scriptFile)
@@ -90,7 +85,6 @@ class ScriptingTests:
9085
* Verify that when ScriptingDriver callback returns false, main is not called.
9186
*/
9287
@Test def scriptCompileOnlyTests =
93-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
9488
val scriptFile = touchFileScript
9589
showScriptUnderTest(scriptFile)
9690

@@ -129,7 +123,6 @@ class ScriptingTests:
129123
* Compile touchFile.sc to create executable jar, verify jar execution succeeds.
130124
*/
131125
@Test def scriptingNoCompileJar: Unit =
132-
assumeFalse("Scripts do not yet support Scala 2 library TASTy", Properties.usingScalaLibraryTasty)
133126
val scriptFile = touchFileScript
134127
showScriptUnderTest(scriptFile)
135128
val expectedJar = script2jar(scriptFile)

0 commit comments

Comments
 (0)