summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-31 18:26:41 +0000
committerPaul Phillips <paulp@improving.org>2012-03-01 21:30:06 -0800
commitda794bb4ee8c89a32f6708e1dae24e28c85ad04a (patch)
tree1563acc28ea06bba118bf4f6d2c91715e0568af5 /test
parentcab91e5e8c1056c878edb1fe34c5adf00ac672cf (diff)
downloadscala-da794bb4ee8c89a32f6708e1dae24e28c85ad04a.tar.gz
scala-da794bb4ee8c89a32f6708e1dae24e28c85ad04a.tar.bz2
scala-da794bb4ee8c89a32f6708e1dae24e28c85ad04a.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')
-rw-r--r--test/files/run/t5052.scala6
-rw-r--r--test/files/run/t5115.scala14
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)
+}