diff options
author | Philipp Haller <hallerp@gmail.com> | 2009-11-03 17:00:06 +0000 |
---|---|---|
committer | Philipp Haller <hallerp@gmail.com> | 2009-11-03 17:00:06 +0000 |
commit | 13d642151f0ad834fad3e8868608d5af5b4372bc (patch) | |
tree | 0bc45ab5991d241ca30be61c09c70e56142b76e5 /test/files | |
parent | d7f7a3e001fb825240554a02a7cff72bef96f409 (diff) | |
download | scala-13d642151f0ad834fad3e8868608d5af5b4372bc.tar.gz scala-13d642151f0ad834fad3e8868608d5af5b4372bc.tar.bz2 scala-13d642151f0ad834fad3e8868608d5af5b4372bc.zip |
Fix and test for #2527
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/enums.check | 1 | ||||
-rw-r--r-- | test/files/run/enums.scala | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/enums.check b/test/files/run/enums.check index b76705b9dd..f53aba8794 100644 --- a/test/files/run/enums.check +++ b/test/files/run/enums.check @@ -1,4 +1,5 @@ test Test1 was successful test Test2 was successful test Test3 was successful +test Test4 was successful 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; } } |