Skip to content

Commit 6dfc129

Browse files
committed
Unit test for #28 PrettyPrinter adds empty attribute with xmlns
* src/test/scala/scala/xml/XMLTest.scala (issue28): New unit test
1 parent 6ef0708 commit 6dfc129

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -824,4 +824,16 @@ expected closing tag of foo
824824
}
825825
}
826826

827+
@UnitTest
828+
def issue28: Unit = {
829+
val x = <x:foo xmlns:x="gaga"/>
830+
// val ns = new NamespaceBinding("x", "gaga", sc)
831+
// val x = Elem("x", "foo", e, ns)
832+
val pp = new xml.PrettyPrinter(80, 2)
833+
// This assertion passed
834+
assertEquals("""<x:foo xmlns:x="gaga"/>""", x.toString)
835+
// This was the bug, producing an errant xmlns attribute
836+
assertEquals("""<x:foo xmlns:x="gaga"/>""", pp.format(x))
837+
}
838+
827839
}

0 commit comments

Comments
 (0)