@@ -58,20 +58,6 @@ class ReplTest(withStaging: Boolean = false, out: ByteArrayOutputStream = new By
58
58
def testFile (f : JFile ): Unit = {
59
59
val prompt = " scala>"
60
60
61
- def extractInputs (lines : BufferedIterator [String ]): List [String ] = {
62
- val input = lines.next()
63
-
64
- if (! input.startsWith(prompt)) extractInputs(lines)
65
- else if (lines.hasNext) {
66
- // read lines and strip trailing whitespace:
67
- while (lines.hasNext && ! lines.head.startsWith(prompt))
68
- lines.next()
69
-
70
- input :: { if (lines.hasNext) extractInputs(lines) else Nil }
71
- }
72
- else Nil
73
- }
74
-
75
61
def evaluate (state : State , input : String ) =
76
62
try {
77
63
val nstate = run(input.drop(prompt.length))(state)
@@ -95,12 +81,10 @@ class ReplTest(withStaging: Boolean = false, out: ByteArrayOutputStream = new By
95
81
val actualOutput = {
96
82
resetToInitial()
97
83
98
- val inputRes = Using (Source .fromFile(f, " UTF-8" )) { source =>
99
- val lines = source.getLines.buffered
100
- assert(lines.head.startsWith(prompt),
101
- s """ Each file has to start with the prompt: " $prompt" """ )
102
- extractInputs(lines)
103
- }.get
84
+ val lines = Using (Source .fromFile(f, " UTF-8" ))(_.getLines.toList).get
85
+ assert(lines.head.startsWith(prompt),
86
+ s """ Each file has to start with the prompt: " $prompt" """ )
87
+ val inputRes = lines.filter(_.startsWith(prompt))
104
88
105
89
val buf = new ArrayBuffer [String ]
106
90
inputRes.foldLeft(initialState) { (state, input) =>
0 commit comments