File tree 2 files changed +17
-2
lines changed
jvm/src/test/scala/scala/xml/parsing
shared/src/main/scala/scala/xml/parsing
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -75,10 +75,22 @@ class ConstructingParserTest {
75
75
@ Test
76
76
def SI6341issue65 : Unit = {
77
77
val str = """ <elem one="test" two="test2" three="test3"/>"""
78
- val cpa = ConstructingParser .fromSource(io. Source .fromString(str), preserveWS = true )
78
+ val cpa = ConstructingParser .fromSource(Source .fromString(str), preserveWS = true )
79
79
val cpadoc = cpa.document()
80
80
val ppr = new PrettyPrinter (80 ,5 )
81
81
val out = ppr.format(cpadoc.docElem)
82
82
assertEquals(str, out)
83
83
}
84
+
85
+ // https://github.com/scala/scala-xml/issues/541
86
+ @ Test
87
+ def issue541 : Unit = {
88
+ val xml =
89
+ """ |<script>// <![CDATA[
90
+ |[]; // ]]>
91
+ |</script>""" .stripMargin
92
+ val parser = ConstructingParser .fromSource(Source .fromString(xml), preserveWS = true )
93
+ parser.document().docElem // shouldn't crash
94
+ }
95
+
84
96
}
Original file line number Diff line number Diff line change @@ -58,7 +58,10 @@ trait MarkupParser extends MarkupParserCommon with TokenTests {
58
58
protected var curInput : Source = input
59
59
60
60
// See ticket #3720 for motivations.
61
- private class WithLookAhead (underlying : Source ) extends Source {
61
+ // As for why it's `private[parsing]` rather than merely `private`, see
62
+ // https://github.com/scala/scala-xml/issues/541 ; the broader access is necessary,
63
+ // for now anyway, to work around https://github.com/lampepfl/dotty/issues/13096
64
+ private [parsing] class WithLookAhead (underlying : Source ) extends Source {
62
65
private val queue = scala.collection.mutable.Queue [Char ]()
63
66
def lookahead (): BufferedIterator [Char ] = {
64
67
val iter = queue.iterator ++ new Iterator [Char ] {
You can’t perform that action at this time.
0 commit comments