summaryrefslogtreecommitdiff
path: root/test/pending
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2006-11-29 22:39:24 +0000
committerBurak Emir <emir@epfl.ch>2006-11-29 22:39:24 +0000
commitf34865ed003a0a045ca73451bcbacd216a3c2830 (patch)
tree35cdb76fa6cf7c7e909cac1ba5219c59e83c16bb /test/pending
parentca3a272ce620c618684432646ca1614ddc3c0b3d (diff)
downloadscala-f34865ed003a0a045ca73451bcbacd216a3c2830.tar.gz
scala-f34865ed003a0a045ca73451bcbacd216a3c2830.tar.bz2
scala-f34865ed003a0a045ca73451bcbacd216a3c2830.zip
more test cases for -Xkilloption
Diffstat (limited to 'test/pending')
-rw-r--r--test/pending/run/testSome.scala35
1 files changed, 28 insertions, 7 deletions
diff --git a/test/pending/run/testSome.scala b/test/pending/run/testSome.scala
index ee5e807151..9ed3a35558 100644
--- a/test/pending/run/testSome.scala
+++ b/test/pending/run/testSome.scala
@@ -1,4 +1,6 @@
-object testSome {
+import testing.SUnit._
+
+object testSome extends Assert {
val x: Option[String] = Some("foo")
@@ -8,15 +10,34 @@ object testSome {
val y1: Option[Int] = None
+ def main(args:Array[String]) = {
+ assertFalse("some[string].isEmpty ", x.isEmpty) // x eq null
+
+ assertFalse("some[int].isEmpty ", x1.isEmpty)
+
+ assertTrue("none<:opt[string].isEmpty ", y.isEmpty)
+
+ assertTrue("non<:opt[int].isEmpty ", y1.isEmpty)
+
+ Console.println(x.get) // x
+
+ Console.println(x1.get)
+
+ val f = {x:String => Some(x.length)}
+
+ val len:Option[Int] = x.flatMap(f)
+ Console.println("len: (3) "+len)
+
+ val g = {x:String => x.charAt(0) == 'f'}
- Console.println(x.isEmpty) // x ne null
+ Console.println("filter: (foo) "+x.filter(g))
- Console.println(x1.isEmpty)
+ // to do:
- Console.println(x.get) // x
+ //assertEquals("equals", len == Some(3))
- Console.println(x1.get)
+ // matching
- def f(x:String) = Some(x)
- x.flatMap(&f)
+ // unapply
+ }
}