diff options
author | michelou <michelou@epfl.ch> | 2007-06-18 09:19:21 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-06-18 09:19:21 +0000 |
commit | 52ccdc5627e3d3d34019b57560601a7e3ec89483 (patch) | |
tree | 9c63a503562b570d0bbffeaf7fb284ab7f639b26 /test/files/run/iterables.scala | |
parent | 2cae4689ebef09384c1d26213a5a9904a2a4e02d (diff) | |
download | scala-52ccdc5627e3d3d34019b57560601a7e3ec89483.tar.gz scala-52ccdc5627e3d3d34019b57560601a7e3ec89483.tar.bz2 scala-52ccdc5627e3d3d34019b57560601a7e3ec89483.zip |
added tests for scala.Iterable
Diffstat (limited to 'test/files/run/iterables.scala')
-rw-r--r-- | test/files/run/iterables.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/run/iterables.scala b/test/files/run/iterables.scala new file mode 100644 index 0000000000..7a29b80e8d --- /dev/null +++ b/test/files/run/iterables.scala @@ -0,0 +1,14 @@ +object Test extends Application { + class Test(n: Int) extends Iterable[Int] { + private var i = 0 + def elements = new Iterator[Int] { + def hasNext = i < n + def next = + if (hasNext) { val v = i; i += 1; v } + else throw new IndexOutOfBoundsException("empty iterator") + } + } + val x = new Test(10) + println(x.isEmpty) + println(x.mkString(",")) +} |