diff options
author | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-11-06 19:06:35 +0000 |
---|---|---|
committer | Antonio Cunei <antonio.cunei@epfl.ch> | 2009-11-06 19:06:35 +0000 |
commit | 5d25e9334d6dfd492cb5312a43b3d3f36042401a (patch) | |
tree | f3740e52f6439d41a0969880aa2a7abd92115141 /test/files/run/collection-stacks.scala | |
parent | d42f62bbd76df85ed57162118a8c720f50bbd5c5 (diff) | |
download | scala-5d25e9334d6dfd492cb5312a43b3d3f36042401a.tar.gz scala-5d25e9334d6dfd492cb5312a43b3d3f36042401a.tar.bz2 scala-5d25e9334d6dfd492cb5312a43b3d3f36042401a.zip |
Moved disabled tests back into their original p...
Moved disabled tests back into their original place. Expect 7 tests to
fail.
Diffstat (limited to 'test/files/run/collection-stacks.scala')
-rw-r--r-- | test/files/run/collection-stacks.scala | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/files/run/collection-stacks.scala b/test/files/run/collection-stacks.scala new file mode 100644 index 0000000000..b159be07aa --- /dev/null +++ b/test/files/run/collection-stacks.scala @@ -0,0 +1,38 @@ +import scala.collection._ + +object Test extends Application { + def mutableStack[T](xs: T*): mutable.Stack[T] = { + val s = new mutable.Stack[T] + s.pushAll(xs) + s + } + + def immutableStack[T](xs: T*): immutable.Stack[T] = { + immutable.Stack.Empty pushAll xs + } + + def check[T](expected: T, got: T) { + println(got + ": " + (expected == got)) + } + + // check #957 + check("1-2-3", immutableStack(1, 2, 3).iterator.mkString("-")) + check("1-2-3", mutableStack(1, 2, 3).iterator.mkString("-")) + + println("apply") + check(1, immutableStack(1, 2, 3).apply(0)) + check(1, mutableStack(1, 2, 3).apply(0)) + check(3, immutableStack(1, 2, 3).apply(2)) + check(3, mutableStack(1, 2, 3).apply(2)) + + println("top") + check(3, immutableStack(1, 2, 3).top) + check(3, mutableStack(1, 2, 3).top) + + println("pop") + check("1-2", immutableStack(1, 2, 3).pop.mkString("-")) + check(3, mutableStack(1, 2, 3).pop()) + check("1-2", { val s = mutableStack(1, 2, 3); s.pop(); s.toList.mkString("-") }) +} + +// vim: set ts=2 sw=2 et: |