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 | |
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')
-rw-r--r-- | test/files/jvm/xml03syntax.check | 2 | ||||
-rw-r--r-- | test/files/run/xml-attribute.scala | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/test/files/jvm/xml03syntax.check b/test/files/jvm/xml03syntax.check index 75dc539137..9fbedc2ae6 100644 --- a/test/files/jvm/xml03syntax.check +++ b/test/files/jvm/xml03syntax.check @@ -23,4 +23,4 @@ true 4 node=<elem key="<b>hello</b>"></elem>, key=Some(<b>hello</b>) -node=<elem ></elem>, key=None +node=<elem></elem>, key=None 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>") + } +} |