Skip to content

Commit c182281

Browse files
committed
Unit test for scala#46 preserve short/self-closing/empty tags
1 parent 121034f commit c182281

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
@@ -542,4 +542,17 @@ class XMLTestJVM {
542542
pp.format(x, sb)
543543
assertEquals(expected, sb.toString)
544544
}
545+
546+
@UnitTest
547+
def issue46: Unit = {
548+
// val x = <node/>
549+
val x = <node></node>
550+
// val x = Elem(null, "node", e, sc)
551+
val pp = new xml.PrettyPrinter(80, 2)
552+
// This assertion passed
553+
assertEquals("<node></node>", x.toString)
554+
// This was the bug, producing <node></node>
555+
assertEquals("<node/>", pp.format(x.copy(minimizeEmpty = true)))
556+
}
557+
545558
}

0 commit comments

Comments
 (0)