@@ -25,11 +25,10 @@ class ExpressionTest:
25
25
assert(result.contains(expected), s " expression [ $expression] did not send [ $expected] to stdout " )
26
26
27
27
@ Test def verifyImports : Unit =
28
-
29
28
val expressionLines = List (
30
29
" 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)" ,
33
32
)
34
33
val expression = expressionLines.mkString(" ;" )
35
34
val success = testExpression(expression){ result =>
@@ -40,11 +39,18 @@ class ExpressionTest:
40
39
def getResult (expression : String ): String =
41
40
val (_, _, stdout, stderr) = bashCommand(s " $scalaPath -e ' $expression' " )
42
41
printf(" stdout: %s\n " , stdout.mkString(" |" ))
43
- printf(" stderr: %s\n " , stderr.mkString(" \n " ," \n " ," " ))
42
+ printf(" stderr: %s\n " , stderr.mkString(" \n " , " \n " , " " ))
44
43
stdout.filter(_.nonEmpty).mkString(" " )
45
44
46
- def testExpression (expression : String )(check : (result : String ) => Boolean ): Boolean = {
45
+ def testExpression (expression : String )(check : (result : String ) => Boolean ): Boolean =
47
46
val result = getResult(expression)
48
47
check(result)
49
- }
50
48
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