Skip to content

Commit 014bdca

Browse files
committed
Unit test for #46 preserve short/self-closing/empty tags
1 parent 642b853 commit 014bdca

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

+13
Original file line numberDiff line numberDiff line change
@@ -547,4 +547,17 @@ class XMLTestJVM {
547547
pp.format(x, sb)
548548
assertEquals(expected, sb.toString)
549549
}
550+
551+
@UnitTest
552+
def issue46: Unit = {
553+
// val x = <node/>
554+
val x = <node></node>
555+
// val x = Elem(null, "node", e, sc)
556+
val pp = new xml.PrettyPrinter(80, 2)
557+
// This assertion passed
558+
assertEquals("<node></node>", x.toString)
559+
// This was the bug, producing <node></node>
560+
assertEquals("<node/>", pp.format(x.copy(minimizeEmpty = true)))
561+
}
562+
550563
}

0 commit comments

Comments
 (0)