summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-11-18 15:41:08 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-11-18 15:41:08 +0000
commit65ba7e2bec96f07beba13fcf1035496a94ca76b3 (patch)
tree17bf38f9dc8149455b24f013c71efd89119a6b59 /test/files/run
parent7f72290295636bc98822dee5994260c480ff42bd (diff)
downloadscala-65ba7e2bec96f07beba13fcf1035496a94ca76b3.tar.gz
scala-65ba7e2bec96f07beba13fcf1035496a94ca76b3.tar.bz2
scala-65ba7e2bec96f07beba13fcf1035496a94ca76b3.zip
Applied patch from #1505, modified supplied exa...
Applied patch from #1505, modified supplied example to be a test.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/t1505.scala25
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"))
+}