Skip to content

Commit fe670f2

Browse files
authored
Merge pull request #496 from SethTisue/revert-pr-279
2 parents 97fabfb + 06f1a36 commit fe670f2

File tree

4 files changed

+4
-37
lines changed

4 files changed

+4
-37
lines changed

Diff for: jvm/src/test/scala/scala/xml/XMLTest.scala

+1-4
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,7 @@ class XMLTestJVM {
315315
val inputStream = new java.io.ByteArrayInputStream(outputStream.toByteArray)
316316
val streamReader = new java.io.InputStreamReader(inputStream, XML.encoding)
317317

318-
def unescapeQuotes(str: String) =
319-
""".r.replaceFirstIn(str, "\"")
320-
val xmlFixed = unescapeQuotes(xml.toString)
321-
assertEquals(xmlFixed, XML.load(streamReader).toString)
318+
assertEquals(xml.toString, XML.load(streamReader).toString)
322319
}
323320

324321
@UnitTest

Diff for: shared/src/main/scala/scala/xml/Text.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Text(data: String) extends Atom[String](data) {
2727
* specification.
2828
*/
2929
override def buildString(sb: StringBuilder): StringBuilder =
30-
Utility.escapeText(data, sb)
30+
Utility.escape(data, sb)
3131
}
3232

3333
/**

Diff for: shared/src/main/scala/scala/xml/Utility.scala

-14
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,6 @@ object Utility extends AnyRef with parsing.TokenTests {
131131
}
132132
}
133133

134-
/**
135-
* Appends escaped string to `s`, but not ".
136-
*/
137-
final def escapeText(text: String, s: StringBuilder): StringBuilder = {
138-
val escTextMap = escMap - '"' // Remove quotes from escMap
139-
text.iterator.foldLeft(s) { (s, c) =>
140-
escTextMap.get(c) match {
141-
case Some(str) => s ++= str
142-
case _ if c >= ' ' || "\n\r\t".contains(c) => s += c
143-
case _ => s // noop
144-
}
145-
}
146-
}
147-
148134
/**
149135
* Appends unescaped string to `s`, `amp` becomes `&`,
150136
* `lt` becomes `<` etc..

Diff for: shared/src/test/scala/scala/xml/XMLTest.scala

+2-18
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ class XMLTest {
256256
@UnitTest
257257
def escape =
258258
assertEquals("""
259-
"Come, come again, whoever you are, come!
259+
"Come, come again, whoever you are, come!
260260
Heathen, fire worshipper or idolatrous, come!
261261
Come even if you broke your penitence a hundred times,
262-
Ours is the portal of hope, come as you are."
262+
Ours is the portal of hope, come as you are."
263263
Mevlana Celaleddin Rumi""", <![CDATA[
264264
"Come, come again, whoever you are, come!
265265
Heathen, fire worshipper or idolatrous, come!
@@ -422,22 +422,6 @@ Ours is the portal of hope, come as you are."
422422
assertHonorsIterableContract(<a a="" y={ null: String }/>.attributes)
423423
}
424424

425-
@UnitTest
426-
def t5645: Unit = {
427-
428-
val bar = "baz"
429-
val script = <script type="text/javascript">
430-
foo("{bar}");
431-
</script>
432-
433-
val expected =
434-
"""|<script type="text/javascript">
435-
| foo("baz");
436-
| </script>""".stripMargin
437-
438-
assertEquals(expected, script.toString)
439-
}
440-
441425
@UnitTest
442426
def t5843: Unit = {
443427
val foo = scala.xml.Attribute(null, "foo", "1", scala.xml.Null)

0 commit comments

Comments
 (0)