diff options
Diffstat (limited to 'scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala')
-rw-r--r-- | scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala | 34 |
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(), () +// ) } } |