summaryrefslogtreecommitdiff
path: root/test/pending/run
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-01-24 15:20:25 +0000
committerBurak Emir <emir@epfl.ch>2007-01-24 15:20:25 +0000
commit0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192 (patch)
tree0bb95122566e05dcc1f81322f3a3740d2e1a81cd /test/pending/run
parent1cbef2171c91fd0e001b4d0c1570c07017877044 (diff)
downloadscala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.tar.gz
scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.tar.bz2
scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.zip
moved working tests to files
Diffstat (limited to 'test/pending/run')
-rw-r--r--test/pending/run/bug405.scala5
-rw-r--r--test/pending/run/retclosure.scala23
-rw-r--r--test/pending/run/unapply.scala86
3 files changed, 0 insertions, 114 deletions
diff --git a/test/pending/run/bug405.scala b/test/pending/run/bug405.scala
deleted file mode 100644
index a1e3864496..0000000000
--- a/test/pending/run/bug405.scala
+++ /dev/null
@@ -1,5 +0,0 @@
-object Test extends Application {
- val x = M;
- object M;
- assert(x eq M)
-}
diff --git a/test/pending/run/retclosure.scala b/test/pending/run/retclosure.scala
deleted file mode 100644
index d354cb3586..0000000000
--- a/test/pending/run/retclosure.scala
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Test return expressions inside closures.
- *
- * See bug#834 */
-
-object Test {
- def response: String = {
- def check: Option[String] = {
- val closure: String=>Nothing =
- p => return Some("some problem") // should return from check
-
- closure("whatever")
- }
-
- check match {
- case Some(problem) => "check failed: " + problem
- case None => "ok"
- }
- }
-
- def main(args: Array[String]) {
- Console.println(response)
- }
-}
diff --git a/test/pending/run/unapply.scala b/test/pending/run/unapply.scala
deleted file mode 100644
index d84711519f..0000000000
--- a/test/pending/run/unapply.scala
+++ /dev/null
@@ -1,86 +0,0 @@
-import scala.testing.SUnit._
-
-object Test {
- def main(args:Array[String]) = {
- Foo.run
- Mas.run
- Lis.run
- }
-}
-
-// this class is used for representation
-class Bar {
- var size: Int = 50
- var name: String = "medium"
-}
-
-// test basic unapply for 0, 1 and 2 args and with precise type test
-object Fii {
- def unapply(x: Any): boolean = x.isInstanceOf[Bar]
-}
-object Faa {
- def unapply(x: Any): Option[String] = if(x.isInstanceOf[Bar]) Some(x.asInstanceOf[Bar].name) else None
-}
-object FaaPrecise {
- def unapply(x: Bar): Option[String] = Some(x.name)
-}
-object FaaPreciseSome {
- def unapply(x: Bar) = Some(x.name) // return type Some[String]
-}
-object Foo extends Assert {
- def unapply(x: Any): Option[Product2[Int, String]] = x match {
- case y: Bar => Some(Tuple(y.size, y.name))
- case _ => None
- }
- def doMatch1(b:Bar) = b match {
- case Foo(s:Int, n:String) => {s,n}
- }
- def doMatch2(b:Bar) = b match {
- case Fii() => null
- }
- def doMatch3(b:Bar) = b match {
- case Faa(n:String) => n
- }
- def doMatch4(b:Bar) = (b:Any) match {
- case FaaPrecise(n:String) => n
- }
- def doMatch5(b:Bar) = (b:Any) match {
- case FaaPreciseSome(n:String) => n
- }
- def run {
- val b = new Bar
- assertEquals(doMatch1(b),{50,"medium"})
- assertEquals(doMatch2(b),null)
- assertEquals(doMatch3(b),"medium")
- assertEquals(doMatch4(b),"medium")
- assertEquals(doMatch5(b),"medium")
- }
-}
-
-// same, but now object is not top-level
-object Mas extends Assert {
- object Gaz {
- def unapply(x: Any): Option[Product2[Int, String]] = x match {
- case y: Baz => Some(Tuple(y.size, y.name))
- case _ => None
- }
- }
- class Baz {
- var size: Int = 60
- var name: String = "too large"
- }
- def run {
- val b = new Baz
- assertEquals(b match {
- case Gaz(s:Int, n:String) => {s,n}
- }, {60,"too large"})
- }
-}
-
-object Lis extends Assert {
- def run {
- assertEquals((List(1,2,3): Any) match { case List(x,y,_*) => {x,y}}, {1,2})
- }
-}
-
-