diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-11-16 15:07:53 -0800 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-11-16 15:07:53 -0800 |
commit | 857c620357775c8ee79de2c53dbdc39456332c4b (patch) | |
tree | c292486380b340aa6cdaa5c65df0d12a20e105b8 /scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala | |
parent | 37adfa72f2658b0859a61f09cae5d400efec123e (diff) | |
download | hands-on-scala-js-857c620357775c8ee79de2c53dbdc39456332c4b.tar.gz hands-on-scala-js-857c620357775c8ee79de2c53dbdc39456332c4b.tar.bz2 hands-on-scala-js-857c620357775c8ee79de2c53dbdc39456332c4b.zip |
Some part of SyntaxTest parses successfully, the match expression doesn't
Diffstat (limited to 'scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala')
-rw-r--r-- | scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala b/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala index 17b0d5f..4562dbd 100644 --- a/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala +++ b/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala @@ -8,32 +8,53 @@ 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) = { - parse(new ScalaSyntax(input)) match{ + def check[T](input: String) = { + new ScalaSyntax(input).CompilationUnit.run() match{ case Failure(f: ParseError) => println(f.formatTraces) - throw new Exception(f.formatTraces) + throw new Exception(f.position + "\t" + f.formatTraces) case Success(parsed) => - assert(parsed == expected) + assert(parsed == input) } - } def tests = TestSuite{ * - check( - """(1 - |)""".stripMargin, - _.ArgumentExprs().run(), () + "package torimatomeru" + + ) + * - check( + """ + |package torimatomeru + | + |import org.parboiled2.ParseError + |import utest._ + |import utest.framework.Test + """.stripMargin + ) * - check( - """(1, - |1)""".stripMargin, - _.ArgumentExprs().run(), () + """ + |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 + """.stripMargin ) * - check( - """val omg = "omg" - |omg * 2""".stripMargin, - _.Block.run(), () + """ + |object SyntaxTest extends TestSuite{ + | def check[T](input: String) = { + | + | } + |} + """.stripMargin ) } } |