diff options
author | Seth Tisue <seth@tisue.net> | 2015-09-02 18:25:29 -0400 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2015-09-02 18:25:29 -0400 |
commit | 5af7f23c63ea13b5132abeb2abaff8b44f5f5f2a (patch) | |
tree | 82b938a722474e371b334181d308c9902577b168 /test/junit | |
parent | fcbb0e262051b36de8608b2fef24bf434adc6e99 (diff) | |
parent | 2c16790ae48debe6e8b07b7ece86b0c665359cfd (diff) | |
download | scala-5af7f23c63ea13b5132abeb2abaff8b44f5f5f2a.tar.gz scala-5af7f23c63ea13b5132abeb2abaff8b44f5f5f2a.tar.bz2 scala-5af7f23c63ea13b5132abeb2abaff8b44f5f5f2a.zip |
Merge pull request #4718 from Ichoran/issue/9379
SI-9379 Added toString to .zipped to allow Stream etc to short-circuit
Diffstat (limited to 'test/junit')
-rw-r--r-- | test/junit/scala/collection/immutable/StreamTest.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/junit/scala/collection/immutable/StreamTest.scala b/test/junit/scala/collection/immutable/StreamTest.scala index fad4e502eb..1b257aabc4 100644 --- a/test/junit/scala/collection/immutable/StreamTest.scala +++ b/test/junit/scala/collection/immutable/StreamTest.scala @@ -107,4 +107,20 @@ class StreamTest { def withFilter_map_properly_lazy_in_tail: Unit = { assertStreamOpLazyInTail(_.withFilter(_ % 2 == 0).map(identity), List(1, 2)) } + + @Test + def test_si9379() { + class Boom { + private var i = -1 + def inc = { + i += 1 + if (i > 1000) throw new NoSuchElementException("Boom! Too many elements!") + i + } + } + val b = new Boom + val s = Stream.continually(b.inc) + // zipped.toString must allow s to short-circuit evaluation + assertTrue((s, s).zipped.toString contains s.toString) + } } |