diff options
author | Paul Phillips <paulp@improving.org> | 2010-10-14 05:10:25 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-10-14 05:10:25 +0000 |
commit | 492f5f52141ecd71f2decdbf7eda7aed51dfb64c (patch) | |
tree | 9863f25a0f46261145c2f01b383ecc3350bb18ed /test | |
parent | 77c31e39ecd2d160cc27270fc8ef31eaa56e3444 (diff) | |
download | scala-492f5f52141ecd71f2decdbf7eda7aed51dfb64c.tar.gz scala-492f5f52141ecd71f2decdbf7eda7aed51dfb64c.tar.bz2 scala-492f5f52141ecd71f2decdbf7eda7aed51dfb64c.zip |
Fixing issue with XMLEventReader.stop failing t...
Fixing issue with XMLEventReader.stop failing to stop the parser thread.
Contributed by Jean-Laurent Huynh, reviewed by extempore. Closes #3881.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/bug3881.check | 1 | ||||
-rw-r--r-- | test/files/run/bug3881.scala | 27 |
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") + } +} + |