@@ -17,9 +17,8 @@ class TestScripts {
1717
1818 private def executeScript (script : String ): (Int , String ) = {
1919 val sb = new StringBuilder
20- val ret = Process (script) ! ProcessLogger { line => println(line); sb.append(line) }
20+ val ret = Process (script) ! ProcessLogger { line => println(line); sb.append(line + " \n " ) }
2121 val output = sb.toString
22- println(output) // For CI, otherwise "terminal inactive for 5m0s, build cancelled"
2322 (ret, output)
2423 }
2524
@@ -59,7 +58,7 @@ class TestScripts {
5958
6059 val (retDotr, dotrOutput) = executeScript(" ./bin/dotr HelloWorld" )
6160 assert(
62- retDotr == 0 && dotrOutput == " hello world" ,
61+ retDotr == 0 && dotrOutput == " hello world\n " ,
6362 s " Running hello world exited with status: $retDotr and output: $dotrOutput"
6463 )
6564 }
@@ -93,8 +92,19 @@ class TestScripts {
9392
9493 /** dotc script should work after corrupting .packages */
9594 @ Test def reCreatesPackagesIfNecessary = doUnlessWindows {
96- executeScript(" sed -i.old 's/2.1/2.X/' ./.packages" ) // That's going to replace 2.11 with 2.X1
97- val (retFirstBuild, _) = executeScript(" ./bin/dotc ./tests/pos/HelloWorld.scala" )
95+ import java .nio .file .{Paths , Files }
96+ import java .nio .charset .StandardCharsets
97+ val contents =
98+ """ |/Users/fixel/Projects/dotty/interfaces/target/dotty-interfaces-0.1.1-bin-SNAPSHOT-X.jar
99+ |/Users/fixel/Projects/dotty/compiler/target/scala-2.11/dotty-compiler_2.1X-0.1.1-bin-SNAPSHOT.jar
100+ |/Users/fixel/Projects/dotty/library/target/scala-2.11/dotty-library_2.1X-0.1.1-bin-SNAPSHOT.jar
101+ |/Users/fixel/Projects/dotty/doc-tool/target/scala-2.11/dotty-doc_2.1X-0.1.1-bin-SNAPSHOT-tests.jar"""
102+ .stripMargin
103+
104+ Files .write(Paths .get(" ./.packages" ), contents.getBytes(StandardCharsets .UTF_8 ))
105+
106+ val (retFirstBuild, output) = executeScript(" ./bin/dotc ./tests/pos/HelloWorld.scala" )
107+ assert(output.contains(" .packages file corrupted" ))
98108 assert(retFirstBuild == 0 , " building dotc failed" )
99109 }
100110}
0 commit comments