Skip to content

Commit af657ce

Browse files
committed
Unit test for #46 preserve short/self-closing/empty tags
1 parent ea9fdf8 commit af657ce

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

+13
Original file line numberDiff line numberDiff line change
@@ -859,4 +859,17 @@ expected closing tag of foo
859859
pp.format(x, sb)
860860
assertEquals(expected, sb.toString)
861861
}
862+
863+
@UnitTest
864+
def issue46: Unit = {
865+
// val x = <node/>
866+
val x = <node></node>
867+
// val x = Elem(null, "node", e, sc)
868+
val pp = new xml.PrettyPrinter(80, 2)
869+
// This assertion passed
870+
assertEquals("<node></node>", x.toString)
871+
// This was the bug, producing <node></node>
872+
assertEquals("<node/>", pp.format(x.copy(minimizeEmpty = true)))
873+
}
874+
862875
}

0 commit comments

Comments
 (0)