@@ -25,11 +25,10 @@ class ExpressionTest:
2525 assert(result.contains(expected), s " expression [ $expression] did not send [ $expected] to stdout " )
2626
2727 @ Test def verifyImports : Unit =
28-
2928 val expressionLines = List (
3029 " import java.nio.file.Paths" ,
31- " import dotty.tools.dotc.config .Properties.userDir" ,
32- s """ println(Paths.get(userDir).toFile.listFiles.toList.filter(_.isDirectory).size) "" " ,
30+ " import scala.util .Properties.userDir" ,
31+ " println(Paths.get(userDir).toFile.listFiles.toList.filter(_.isDirectory).size)" ,
3332 )
3433 val expression = expressionLines.mkString(" ;" )
3534 val success = testExpression(expression){ result =>
@@ -40,11 +39,18 @@ class ExpressionTest:
4039 def getResult (expression : String ): String =
4140 val (_, _, stdout, stderr) = bashCommand(s " $scalaPath -e ' $expression' " )
4241 printf(" stdout: %s\n " , stdout.mkString(" |" ))
43- printf(" stderr: %s\n " , stderr.mkString(" \n " ," \n " ," " ))
42+ printf(" stderr: %s\n " , stderr.mkString(" \n " , " \n " , " " ))
4443 stdout.filter(_.nonEmpty).mkString(" " )
4544
46- def testExpression (expression : String )(check : (result : String ) => Boolean ): Boolean = {
45+ def testExpression (expression : String )(check : (result : String ) => Boolean ): Boolean =
4746 val result = getResult(expression)
4847 check(result)
49- }
5048
49+ object ExpressionTest :
50+
51+ def main (args : Array [String ]): Unit =
52+ val tests = new ExpressionTest
53+ println(" \n === verifyCommandLineExpression ===" )
54+ tests.verifyCommandLineExpression
55+ println(" \n === verifyImports ===" )
56+ tests.verifyImports
0 commit comments