From 52ccdc5627e3d3d34019b57560601a7e3ec89483 Mon Sep 17 00:00:00 2001 From: michelou Date: Mon, 18 Jun 2007 09:19:21 +0000 Subject: added tests for scala.Iterable --- test/files/run/iterables.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/files/run/iterables.scala (limited to 'test/files/run/iterables.scala') 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(",")) +} -- cgit v1.2.3