summaryrefslogtreecommitdiff
path: root/test/files/run/reify_csv.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-03 17:11:30 -0700
committerPaul Phillips <paulp@improving.org>2012-05-03 17:15:31 -0700
commit8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284 (patch)
tree4f445792891bd6945ce8132b97a0231a8cf54392 /test/files/run/reify_csv.scala
parent58f6a1346093db2f407879246884d480ff8d7904 (diff)
downloadscala-8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284.tar.gz
scala-8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284.tar.bz2
scala-8bc8b83f0bd7daef62b41b4a0c87b4e9b7344284.zip
Moved passing tests from pending to files.
Most are pattern matcher bugs fixed by virtpatmat. A few are reifier, package object, or miscellaneous. I threw in an original test for SI-2337, to go with those for SI-1697, SI-3705, SI-4415, and SI-1357, all of which (in the interests of making sure this basket has all the eggs) I am closing.
Diffstat (limited to 'test/files/run/reify_csv.scala')
-rw-r--r--test/files/run/reify_csv.scala35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/files/run/reify_csv.scala b/test/files/run/reify_csv.scala
new file mode 100644
index 0000000000..966521575c
--- /dev/null
+++ b/test/files/run/reify_csv.scala
@@ -0,0 +1,35 @@
+import scala.reflect.mirror._
+
+object Test extends App {
+ val csv = """
+ | phase name; id; description
+ | parser; 1; parse source into ASTs, perform simple desugaring
+ | namer; 2; resolve names, attach symbols to named trees
+ |packageobjects; 3; load package objects
+ | typer; 4; the meat and potatoes: type the trees
+ |superaccessors; 5; add super accessors in traits and nested classes
+ | pickler; 6; serialize symbol tables
+ | refchecks; 7; reference/override checking, translate nested objects
+ | selectiveanf; 8;
+ | liftcode; 9; reify trees""".stripMargin.split("\n").map{_.trim()}.drop(1).toList
+
+ val fields = csv.head.split(";").map{_.trim()}.toList
+ println(fields)
+
+ reify({
+ object Csv {
+ case class record(`phase name`: String, id: String, description: String)
+
+ object record {
+ def parse(lines: List[String]) = {
+ lines drop(1) map { line => line.split(";", -1).toList match {
+ case phase$whitespace$name :: id :: description :: _ => record(phase$whitespace$name.trim(), id.trim(), description.trim())
+ case _ => throw new Exception("format error")
+ }}
+ }
+ }
+ }
+
+ Csv.record.parse(csv) foreach println
+ }).eval
+}