Skip to content

Commit bce3b4b

Browse files
committed
Unit tests for scala#76 PrettyPrinter removes newlines
1 parent 3161a38 commit bce3b4b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/test/scala/scala/xml/XMLTest.scala

+14
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,20 @@ expected closing tag of foo
838838
assertEquals("""<x:foo xmlns:x="gaga"/>""", pp.format(x))
839839
}
840840

841+
@UnitTest
842+
def issue76: Unit = {
843+
val pp = new PrettyPrinter(9999,2)
844+
val x = <foo>{"hi\nthere"}</foo>
845+
assertEquals("<foo>hi\nthere</foo>", x.toString)
846+
assertEquals("<foo>hi there</foo>", pp.format(x))
847+
val y = PCData("hi\nthere")
848+
assertEquals("<![CDATA[hi\nthere]]>", y.toString)
849+
assertEquals("<![CDATA[hi\nthere]]>", pp.format(y))
850+
val z = <foo>{PCData("hi\nthere")}</foo>
851+
assertEquals("<foo><![CDATA[hi\nthere]]></foo>", z.toString)
852+
assertEquals("<foo><![CDATA[hi\nthere]]></foo>", pp.format(z))
853+
}
854+
841855
@UnitTest
842856
def nodeSeqNs: Unit = {
843857
val x = {

0 commit comments

Comments
 (0)