diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t1505.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/files/run/t1505.scala b/test/files/run/t1505.scala new file mode 100644 index 0000000000..25c1a9117b --- /dev/null +++ b/test/files/run/t1505.scala @@ -0,0 +1,25 @@ +object P extends Enumeration(0, "A", "B", "C") { val A, B, C = Value } + +object Q extends Enumeration { + val A = Value("A") + val B = Value("B") + val C = Value("C") +} + +object R extends Enumeration { + val A, B, C = Value +} + +object Test extends Application { + assert(Some(P(0)) == P.valueOf("A")) + assert(Some(P.C) == P.valueOf("C")) + assert(None == P.valueOf("Q")) + + assert(Some(Q(0)) == Q.valueOf("A")) + assert(Some(Q.C) == Q.valueOf("C")) + assert(None == Q.valueOf("Q")) + + assert(None == R.valueOf("A")) + assert(None == R.valueOf("C")) + assert(None == R.valueOf("Q")) +} |