summaryrefslogtreecommitdiff
path: root/test/files/run/enums.scala
diff options
context:
space:
mode:
authorPhilipp Haller <hallerp@gmail.com>2009-11-03 17:00:06 +0000
committerPhilipp Haller <hallerp@gmail.com>2009-11-03 17:00:06 +0000
commit13d642151f0ad834fad3e8868608d5af5b4372bc (patch)
tree0bc45ab5991d241ca30be61c09c70e56142b76e5 /test/files/run/enums.scala
parentd7f7a3e001fb825240554a02a7cff72bef96f409 (diff)
downloadscala-13d642151f0ad834fad3e8868608d5af5b4372bc.tar.gz
scala-13d642151f0ad834fad3e8868608d5af5b4372bc.tar.bz2
scala-13d642151f0ad834fad3e8868608d5af5b4372bc.zip
Fix and test for #2527
Diffstat (limited to 'test/files/run/enums.scala')
-rw-r--r--test/files/run/enums.scala20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/enums.scala b/test/files/run/enums.scala
index 99986787b7..fcca8d3438 100644
--- a/test/files/run/enums.scala
+++ b/test/files/run/enums.scala
@@ -46,6 +46,25 @@ object Test3 {
}
}
+object Test4 {
+
+ object Direction extends Enumeration("North", "South", "East", "West") {
+ val North, South, East, West = Value;
+ }
+
+ def run: Int = {
+ val dir = Direction.withName("North")
+ assert(dir.toString == "North")
+ try {
+ Direction.withName("Nord")
+ assert(false)
+ } catch {
+ case e: Exception => /* do nothing */
+ }
+ 0
+ }
+}
+
//############################################################################
// Test code
@@ -73,6 +92,7 @@ object Test {
check_success("Test1", Test1.run, 5);
check_success("Test2", Test2.run, 5);
check_success("Test3", Test3.run, 1);
+ check_success("Test4", Test4.run, 0);
Console.println;
}
}