From 65ba7e2bec96f07beba13fcf1035496a94ca76b3 Mon Sep 17 00:00:00 2001 From: Geoffrey Washburn Date: Tue, 18 Nov 2008 15:41:08 +0000 Subject: Applied patch from #1505, modified supplied exa... Applied patch from #1505, modified supplied example to be a test. --- test/files/run/t1505.scala | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/files/run/t1505.scala (limited to 'test/files/run') 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")) +} -- cgit v1.2.3