summaryrefslogtreecommitdiff
path: root/test/disabled/run/collection-stacks.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-05-09 03:53:41 +0000
committerPaul Phillips <paulp@improving.org>2009-05-09 03:53:41 +0000
commit2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2 (patch)
tree9bb2044c595fe260c352a00cf98bb2ecece50437 /test/disabled/run/collection-stacks.scala
parentf7ab13b08e085c3bf94d857fc9648ee724e4cb08 (diff)
downloadscala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.tar.gz
scala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.tar.bz2
scala-2ea3b94ee2519e01a3e1658909afeb33e7e9ebe2.zip
Organized disabled directory so it works with p...
Organized disabled directory so it works with partest. You can run ./partest --srcpath disabled to run the tests in that location. Fixed a few tests in disabled and pending and moved to files.
Diffstat (limited to 'test/disabled/run/collection-stacks.scala')
-rw-r--r--test/disabled/run/collection-stacks.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/disabled/run/collection-stacks.scala b/test/disabled/run/collection-stacks.scala
new file mode 100644
index 0000000000..665fb91e13
--- /dev/null
+++ b/test/disabled/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).elements.mkString("-"))
+ check("1-2-3", mutableStack(1, 2, 3).elements.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: