diff options
author | Josh Suereth <joshua.suereth@gmail.com> | 2012-08-20 12:12:50 -0400 |
---|---|---|
committer | Josh Suereth <joshua.suereth@gmail.com> | 2012-08-20 12:12:50 -0400 |
commit | 24502208feff83d6a7b8197f5051856ec5cf9983 (patch) | |
tree | 0791f88eb4d0fa0fcf2f7303272d9a9ac10893a4 /test/files | |
parent | 74e3b4dc8b85b0f861ce9a87e8765654a3ac40f8 (diff) | |
download | scala-24502208feff83d6a7b8197f5051856ec5cf9983.tar.gz scala-24502208feff83d6a7b8197f5051856ec5cf9983.tar.bz2 scala-24502208feff83d6a7b8197f5051856ec5cf9983.zip |
Adding test for try-catch library unification.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/try-catch-unify.check | 3 | ||||
-rw-r--r-- | test/files/run/try-catch-unify.scala | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/try-catch-unify.check b/test/files/run/try-catch-unify.check new file mode 100644 index 0000000000..b1de2bfa74 --- /dev/null +++ b/test/files/run/try-catch-unify.check @@ -0,0 +1,3 @@ +Failure(java.lang.NumberFormatException: For input string: "Hi") +Success(5.0) +O NOES diff --git a/test/files/run/try-catch-unify.scala b/test/files/run/try-catch-unify.scala new file mode 100644 index 0000000000..0d819ab957 --- /dev/null +++ b/test/files/run/try-catch-unify.scala @@ -0,0 +1,15 @@ +import util._ + +import control.Exception._ + +object Test { + def main(args: Array[String]): Unit = { + println(catching(classOf[NumberFormatException]) withTry ("Hi".toDouble)) + println(catching(classOf[NumberFormatException]) withTry ("5".toDouble)) + try { + catching(classOf[NumberFormatException]) withTry (sys.error("O NOES")) + } catch { + case t => println(t.getMessage) + } + } +} |