Skip to content

Commit d2281e2

Browse files
committed
Unit test for scala#46 preserve short/self-closing/empty tags
1 parent 713d2d9 commit d2281e2

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
@@ -874,4 +874,17 @@ expected closing tag of foo
874874
pp.format(x, sb)
875875
assertEquals(expected, sb.toString)
876876
}
877+
878+
@UnitTest
879+
def issue46: Unit = {
880+
// val x = <node/>
881+
val x = <node></node>
882+
// val x = Elem(null, "node", e, sc)
883+
val pp = new xml.PrettyPrinter(80, 2)
884+
// This assertion passed
885+
assertEquals("<node></node>", x.toString)
886+
// This was the bug, producing <node></node>
887+
assertEquals("<node/>", pp.format(x.copy(minimizeEmpty = true)))
888+
}
889+
877890
}

0 commit comments

Comments
 (0)