diff options
author | Szabolcs Berecz <szabolcs.berecz@gmail.com> | 2012-01-07 17:40:00 +0100 |
---|---|---|
committer | Szabolcs Berecz <szabolcs.berecz@gmail.com> | 2012-01-07 18:43:16 +0100 |
commit | 4787f883604d1344257c0b40c15790c3dde477f2 (patch) | |
tree | 10db179b6aab792eda2f5a55cb1fc67b35f147be /test/files/run | |
parent | a6ebd0f3ee2610ce1f5c3b2aee269ea8b2cfd6df (diff) | |
download | scala-4787f883604d1344257c0b40c15790c3dde477f2.tar.gz scala-4787f883604d1344257c0b40c15790c3dde477f2.tar.bz2 scala-4787f883604d1344257c0b40c15790c3dde477f2.zip |
Fixed equality and string representation of xml attributes with null value
Prior to this patch <t a={ null: String }/> was not equal to <t/> and
it's string representation was "<t ></t>" instead of "<t></t>"
This includes changing MetaData.normalize() so that it doesn't reverse
the chain. On the downside, the iterate function in MetaData.normalize()
is not tail-recursive now.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/xml-attribute.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/run/xml-attribute.scala b/test/files/run/xml-attribute.scala new file mode 100644 index 0000000000..2b83f70b22 --- /dev/null +++ b/test/files/run/xml-attribute.scala @@ -0,0 +1,14 @@ +import xml.Node + +object Test { + def main(args: Array[String]): Unit = { + val noAttr = <t/> + val attrNull = <t a={ null: String }/> + val attrNone = <t a={ None: Option[Seq[Node]] }/> + assert(noAttr == attrNull) + assert(noAttr == attrNone) + assert(noAttr.toString() == "<t></t>") + assert(attrNull.toString() == "<t></t>") + assert(attrNone.toString() == "<t></t>") + } +} |