summaryrefslogtreecommitdiff
path: root/test/files/run/t5115.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-31 18:26:41 +0000
committerPaul Phillips <paulp@improving.org>2011-10-31 18:26:41 +0000
commitbf0b9fcf84d346231db868e522dce17ded59888e (patch)
tree96018455ecbe2abcab7a1f347c814347c9a1d2e0 /test/files/run/t5115.scala
parent8de176f454d1e365b1297de21a0ed4a45c04a87f (diff)
downloadscala-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/t5115.scala')
-rw-r--r--test/files/run/t5115.scala14
1 files changed, 14 insertions, 0 deletions
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)
+}