summaryrefslogtreecommitdiff
path: root/test/files/run/t10261/Test_2.scala
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/run/t10261/Test_2.scala')
-rw-r--r--test/files/run/t10261/Test_2.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/run/t10261/Test_2.scala b/test/files/run/t10261/Test_2.scala
new file mode 100644
index 0000000000..d7d9fe9a0e
--- /dev/null
+++ b/test/files/run/t10261/Test_2.scala
@@ -0,0 +1,14 @@
+import scala.util.Try
+
+object C extends Companion[C] {
+ def parse(v: String) = if (v.nonEmpty) Some(new C(v)) else None
+}
+
+case class C(value: String)
+
+object Test {
+ def main(args: Array[String]): Unit = {
+ assert(Try{C("")}.isFailure, "Empty value should fail to parse") // check that parse is used to validate input
+ assert(C("a").value == "a", "Unexpected value")
+ }
+}