summaryrefslogtreecommitdiff
path: root/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-11-16 14:23:02 -0800
committerLi Haoyi <haoyi@dropbox.com>2014-11-16 14:23:02 -0800
commit04a1483c131da376a085c63fc02954f21d3d7a1b (patch)
tree6b70b766ba5878f9fa77dcac056b18e45947e758 /scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala
parent70f9164e167398d75f99130a5325a3411215feb5 (diff)
downloadhands-on-scala-js-04a1483c131da376a085c63fc02954f21d3d7a1b.tar.gz
hands-on-scala-js-04a1483c131da376a085c63fc02954f21d3d7a1b.tar.bz2
hands-on-scala-js-04a1483c131da376a085c63fc02954f21d3d7a1b.zip
WIP
Diffstat (limited to 'scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala')
-rw-r--r--scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala34
1 files changed, 29 insertions, 5 deletions
diff --git a/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala b/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala
index 8d5a0d8..c0cbcfa 100644
--- a/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala
+++ b/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala
@@ -1,18 +1,42 @@
package torimatomeru
+
+import org.parboiled2.ParseError
import utest._
import utest.framework.Test
import utest.util.Tree
+import scala.util.{Failure, Success}
+
object SyntaxTest extends TestSuite{
def check[T](input: String, parse: ScalaSyntax => scala.util.Try[T], expected: T) = {
- val parsed = parse(new ScalaSyntax(input)).get
- assert(parsed == expected)
+ parse(new ScalaSyntax(input)) match{
+ case Failure(f: ParseError) =>
+ println(f.formatTraces)
+ throw new Exception(f.formatTraces)
+ case Success(parsed) =>
+ assert(parsed == expected)
+ }
+
}
def tests = TestSuite{
- "omg" - check(
- """if (true) () else ()""",
- _.IfCFlow.run(), ()
+ * - check(
+ """(1
+ |)""".stripMargin,
+ _.ArgumentExprs().run(), ()
+ )
+ * - check(
+ """(1,
+ |)""".stripMargin,
+ _.ArgumentExprs().run(), ()
)
+// * - check(
+// """(1, 2,
+// |3
+// |,
+// |4
+// |)""".stripMargin,
+// _.ArgumentExprs().run(), ()
+// )
}
}