Skip to content

Commit f3acdbd

Browse files
committed
work around scala/bug#11152 on JDK 11
1 parent 1e45519 commit f3acdbd

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

scalatest/src/main/scala/org/scalatest/Doc.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ println("&&&&&&&&&&&")
144144

145145
private[scalatest] def getSnippets(text: String): Vector[Snippet] = {
146146
//println("text: " + text)
147-
val lines = Vector.empty ++ text.lines.toIterable
147+
// work around scala/bug#11152 on JDK 11
148+
val lines = Vector.empty ++ Predef.augmentString(text).lines.toIterable
148149
//println("lines: " + lines)
149150
val pairs = lines map { line =>
150151
val trimmed = line.trim
@@ -186,7 +187,8 @@ println("&&&&&&&&&&&")
186187
private[scalatest] object Doc {
187188

188189
private[scalatest] def trimMarkup(text: String): String = {
189-
val lines = text.lines.toList
190+
// work around scala/bug#11152 on JDK 11
191+
val lines = Predef.augmentString(text).lines.toList
190192
val zipLines = lines.zipWithIndex
191193
val firstNonWhiteLine = zipLines.find { case (line, _) => !line.trim.isEmpty }
192194
val lastNonWhiteLine = zipLines.reverse.find { case (line, _) => !line.trim.isEmpty }
@@ -197,7 +199,8 @@ private[scalatest] object Doc {
197199
}
198200

199201
private[scalatest] def stripMargin(text: String): String = {
200-
val lines = text.lines.toList
202+
// work around scala/bug#11152 on JDK 11
203+
val lines = Predef.augmentString(text).lines.toList
201204
val firstNonWhiteLine = lines.find(!_.trim.isEmpty)
202205
firstNonWhiteLine match {
203206
case None => text.trim

scalatest/src/main/scala/org/scalatest/DocSpec.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ private[scalatest] abstract class DocSpec extends DocSpecLike {
4141
private[scalatest] object DocSpec {
4242

4343
def trimMarkup(text: String): String = {
44-
val lines = text.lines.toList
44+
// work around scala/bug#11152 on JDK 11
45+
val lines = Predef.augmentString(text).lines.toList
4546
val zipLines = lines.zipWithIndex
4647
val firstNonWhiteLine = zipLines.find { case (line, _) => !line.trim.isEmpty }
4748
val lastNonWhiteLine = zipLines.reverse.find { case (line, _) => !line.trim.isEmpty }
@@ -52,7 +53,8 @@ private[scalatest] object DocSpec {
5253
}
5354

5455
def stripMargin(text: String): String = {
55-
val lines = text.lines.toList
56+
// work around scala/bug#11152 on JDK 11
57+
val lines = Predef.augmentString(text).lines.toList
5658
val firstNonWhiteLine = lines.find(!_.trim.isEmpty)
5759
firstNonWhiteLine match {
5860
case None => text.trim

0 commit comments

Comments
 (0)