@@ -17,9 +17,8 @@ class TestScripts {
17
17
18
18
private def executeScript (script : String ): (Int , String ) = {
19
19
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 " ) }
21
21
val output = sb.toString
22
- println(output) // For CI, otherwise "terminal inactive for 5m0s, build cancelled"
23
22
(ret, output)
24
23
}
25
24
@@ -59,7 +58,7 @@ class TestScripts {
59
58
60
59
val (retDotr, dotrOutput) = executeScript(" ./bin/dotr HelloWorld" )
61
60
assert(
62
- retDotr == 0 && dotrOutput == " hello world" ,
61
+ retDotr == 0 && dotrOutput == " hello world\n " ,
63
62
s " Running hello world exited with status: $retDotr and output: $dotrOutput"
64
63
)
65
64
}
@@ -93,8 +92,19 @@ class TestScripts {
93
92
94
93
/** dotc script should work after corrupting .packages */
95
94
@ 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" ))
98
108
assert(retFirstBuild == 0 , " building dotc failed" )
99
109
}
100
110
}
0 commit comments