summaryrefslogtreecommitdiff
path: root/scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala')
-rw-r--r--scalatexApi/src/test/scala/torimatomeru/SyntaxTest.scala49
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
)
}
}