Skip to content

Commit b716ec7

Browse files
committed
tests: Only toolArgsParse the first 10 lines
1 parent 04946d2 commit b716ec7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler/test/dotty/tools/utils.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def assertThrows[T <: Throwable: ClassTag](p: T => Boolean)(body: => Any): Unit
4545
end assertThrows
4646

4747
def toolArgsFor(files: List[JPath])(using codec: Codec = Codec.UTF8): List[String] =
48-
files.flatMap(path => toolArgsParse(readLines(path.toFile)))
48+
files.flatMap(path => toolArgsParse(withFile(path.toFile)(_.getLines().take(10).toList)))
4949

5050
// Inspect the first 10 of the given lines for compiler options of the form
5151
// `// scalac: args`, `/* scalac: args`, ` * scalac: args`.
@@ -57,7 +57,8 @@ def toolArgsParse(lines: List[String]): List[String] = {
5757
val endc = "*" + "/" // be forgiving of /* scalac: ... */
5858
def stripped(s: String) = s.substring(s.indexOf(tag) + tag.length).stripSuffix(endc)
5959
val args = lines.to(LazyList).take(10).filter { s =>
60-
s.contains("// " + tag)
60+
s.contains("//" + tag)
61+
|| s.contains("// " + tag)
6162
|| s.contains("/* " + tag)
6263
|| s.contains(" * " + tag)
6364
// but avoid picking up comments like "% scalac ./a.scala" and "$ scalac a.scala"

0 commit comments

Comments
 (0)