summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2010-06-02 09:57:41 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2010-06-02 09:57:41 +0000
commit2eab8f31341d787a29a7329f40ffc870f5ab594c (patch)
tree69bcc88b4fd98e70ce4c0f29415174842acb81d6 /test/files
parentf3d87c08f6bcdb864e6990194668ad6dc16826a9 (diff)
downloadscala-2eab8f31341d787a29a7329f40ffc870f5ab594c.tar.gz
scala-2eab8f31341d787a29a7329f40ffc870f5ab594c.tar.bz2
scala-2eab8f31341d787a29a7329f40ffc870f5ab594c.zip
some tests. no review
Diffstat (limited to 'test/files')
-rw-r--r--test/files/run/bitsets-msil.check32
-rw-r--r--test/files/run/exceptions-nest.check12
-rw-r--r--test/files/run/exceptions-nest.scala139
3 files changed, 167 insertions, 16 deletions
diff --git a/test/files/run/bitsets-msil.check b/test/files/run/bitsets-msil.check
index 9fefa3125e..b187571bff 100644
--- a/test/files/run/bitsets-msil.check
+++ b/test/files/run/bitsets-msil.check
@@ -1,23 +1,23 @@
-ms0 = Set(2)
-ms1 = Set(2)
-ms2 = Set(2)
+ms0 = BitSet(2)
+ms1 = BitSet(2)
+ms2 = BitSet(2)
mb0 = False
mb1 = True
mb2 = False
xs0 = List(2)
xs1 = List(2)
xs2 = List(2)
-ma0 = List(4)
-ma1 = List(4)
-ma2 = List(4)
-mi0 = Set(2)
-mi1 = Set(2)
-mi2 = Set(2)
+ma0 = List(2)
+ma1 = List(2)
+ma2 = List(2)
+mi0 = BitSet(2)
+mi1 = BitSet(2)
+mi2 = BitSet(2)
-is0 = Set()
-is1 = Set()
-is2 = Set(2)
-is3 = Set()
+is0 = BitSet()
+is1 = BitSet()
+is2 = BitSet(2)
+is3 = BitSet()
ib0 = False
ib1 = False
ib2 = True
@@ -26,8 +26,8 @@ ys0 = List()
ys1 = List()
ys2 = List(2)
ys3 = List()
-ia0 = List(0)
-ia1 = List(0)
-ia2 = List(4)
+ia0 = List()
+ia1 = List()
+ia2 = List(2)
ia3 = List()
diff --git a/test/files/run/exceptions-nest.check b/test/files/run/exceptions-nest.check
new file mode 100644
index 0000000000..ae66da0a99
--- /dev/null
+++ b/test/files/run/exceptions-nest.check
@@ -0,0 +1,12 @@
+2
+23
+2
+5
+2
+4
+OK
+4
+OK
+10
+1
+()
diff --git a/test/files/run/exceptions-nest.scala b/test/files/run/exceptions-nest.scala
new file mode 100644
index 0000000000..40b00988e4
--- /dev/null
+++ b/test/files/run/exceptions-nest.scala
@@ -0,0 +1,139 @@
+object Test extends Application {
+
+ println(test1)
+ println(test2)
+ println(test3)
+ println(test4)
+ println(test5)
+ try { println(test6) } catch { case _ => println("OK") }
+ println(test7)
+ try { println(test8) } catch { case _ => println("OK") }
+ println(test9)
+ println(test10)
+ println(test11)
+
+ def test1 = {
+ var x = 1
+ try {
+ x = 2
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ x
+ }
+
+ def test2 = {
+ var x = 1
+ try {
+ x = 2
+ try {
+ x = 21
+ } catch {
+ case _ => x = 22
+ }
+ x = 23
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ x
+ }
+
+ def test3 = {
+ var x = 1
+ try {
+ try{x = 2} catch { case _ => x = 4 }
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ x
+ }
+
+ def test4 = {
+ var x = 1
+ try {
+ x = 2
+ } catch {
+ case _: NullPointerException => x = 3
+ case _ => x = 4
+ }
+ try {
+ x = 5
+ } catch {
+ case _: NullPointerException => x = 6
+ }
+ x
+ }
+
+ def test5 = {
+ var x = 1
+ try {
+ x = 2
+ } catch {
+ case _: NullPointerException => try { x = 3 } catch { case f => throw f }
+ case _ => x = 4; try { x = 41 } catch { case _: Exception => x = 42 }; x = 43
+ }
+ x
+ }
+
+ def test6: Int = {
+ var x = 1
+ try {
+ x = 2
+ (null: String).toString
+ } catch {
+ case e: NullPointerException =>
+ throw e
+ case _ =>
+ x = 3
+ return 1000
+ } finally {
+ x = 4
+ println(x)
+ }
+ x
+ }
+
+ def test7 = {
+ var x = 1
+ try {
+ x = 2
+ } finally {
+ try {
+ x = 4
+ } catch {
+ case _ => x = 5
+ }
+ }
+ x
+ }
+
+ def test8 = {
+ var x = 1
+ try {
+ throw new NullPointerException
+ } catch {
+ case e => throw e
+ }
+ x
+ }
+
+ def test9 = {
+ try { "" match {
+ case s: String => 10
+ }} catch { case _ => 20 }
+ }
+
+ var x10 = 1
+ def test10: Int = {
+ try { 1 }
+ catch { case e if (x10 == 1) => 1 }
+ }
+
+ def test11 {
+ try { () }
+ catch { case e => () }
+ }
+}