diff options
author | Paul Phillips <paulp@improving.org> | 2011-10-31 18:26:41 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-10-31 18:26:41 +0000 |
commit | bf0b9fcf84d346231db868e522dce17ded59888e (patch) | |
tree | 96018455ecbe2abcab7a1f347c814347c9a1d2e0 /test/files/run | |
parent | 8de176f454d1e365b1297de21a0ed4a45c04a87f (diff) | |
download | scala-bf0b9fcf84d346231db868e522dce17ded59888e.tar.gz scala-bf0b9fcf84d346231db868e522dce17ded59888e.tar.bz2 scala-bf0b9fcf84d346231db868e522dce17ded59888e.zip |
Fixes NPE using iterator with an XML attribute ...
Fixes NPE using iterator with an XML attribute being null or None )
(SI-5052 Also fixes incorrect size method (SI-5115 )
Contributed by Jordi Salvat i Alabart. Closes SI-5052, SI-5115, no
review.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t5052.scala | 6 | ||||
-rw-r--r-- | test/files/run/t5115.scala | 14 |
2 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/t5052.scala b/test/files/run/t5052.scala new file mode 100644 index 0000000000..9e418e8ac5 --- /dev/null +++ b/test/files/run/t5052.scala @@ -0,0 +1,6 @@ +object Test extends App { + assert(<elem attr={null:String} /> xml_== <elem />) + assert(<elem attr={None} /> xml_== <elem />) + assert(<elem /> xml_== <elem attr={null:String} />) + assert(<elem /> xml_== <elem attr={None} />) +} diff --git a/test/files/run/t5115.scala b/test/files/run/t5115.scala new file mode 100644 index 0000000000..cf25214715 --- /dev/null +++ b/test/files/run/t5115.scala @@ -0,0 +1,14 @@ +import scala.collection.Iterable + +object Test extends App { + def assertHonorsIterableContract(i: Iterable[_]) = assert(i.size == i.iterator.size) + + assertHonorsIterableContract(<a/>.attributes) + assertHonorsIterableContract(<a x=""/>.attributes) + assertHonorsIterableContract(<a y={None}/>.attributes) + assertHonorsIterableContract(<a y={None} x=""/>.attributes) + assertHonorsIterableContract(<a a="" y={None} />.attributes) + assertHonorsIterableContract(<a y={null:String}/>.attributes) + assertHonorsIterableContract(<a y={null:String} x=""/>.attributes) + assertHonorsIterableContract(<a a="" y={null:String} />.attributes) +} |