summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/run/bug3881.check1
-rw-r--r--test/files/run/bug3881.scala27
2 files changed, 28 insertions, 0 deletions
diff --git a/test/files/run/bug3881.check b/test/files/run/bug3881.check
new file mode 100644
index 0000000000..888acde74f
--- /dev/null
+++ b/test/files/run/bug3881.check
@@ -0,0 +1 @@
+1000000 xml events
diff --git a/test/files/run/bug3881.scala b/test/files/run/bug3881.scala
new file mode 100644
index 0000000000..21247492f5
--- /dev/null
+++ b/test/files/run/bug3881.scala
@@ -0,0 +1,27 @@
+object Test {
+
+ def forever() = new io.Source {
+ val iter = "<foo>".iterator ++ new Iterator[Char] {
+ var count = -1
+ val bar = "<bar/>\n"
+ def hasNext = true
+ def next() = {
+ count += 1
+ bar(count % bar.length)
+ }
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ val src = forever()
+ val reader = new xml.pull.XMLEventReader(src)
+ var count = 0
+ while (reader.hasNext && count < 1000000) {
+ reader.next
+ count += 1
+ }
+ reader.stop
+ println(count + " xml events")
+ }
+}
+