diff options
author | Li Haoyi <haoyi@dropbox.com> | 2014-11-17 00:00:09 -0800 |
---|---|---|
committer | Li Haoyi <haoyi@dropbox.com> | 2014-11-17 00:00:09 -0800 |
commit | f9f749398874120e93eb5bc15eaffbe21462b398 (patch) | |
tree | 377dcb880a33e7c12b19dc2f783b2c2b75f91c58 /scalatexApi/src/test | |
parent | e070b389be002f955785ad8ccc8cdeb41f34a9f4 (diff) | |
download | hands-on-scala-js-f9f749398874120e93eb5bc15eaffbe21462b398.tar.gz hands-on-scala-js-f9f749398874120e93eb5bc15eaffbe21462b398.tar.bz2 hands-on-scala-js-f9f749398874120e93eb5bc15eaffbe21462b398.zip |
Fixed type patterns to use CompoundType to not collide with with `=>` in pattern matches
Diffstat (limited to 'scalatexApi/src/test')
-rw-r--r-- | scalatexApi/src/test/scala/scalaparser/SyntaxTest.scala | 76 |
1 files changed, 73 insertions, 3 deletions
diff --git a/scalatexApi/src/test/scala/scalaparser/SyntaxTest.scala b/scalatexApi/src/test/scala/scalaparser/SyntaxTest.scala index 2c16962..4e69bc2 100644 --- a/scalatexApi/src/test/scala/scalaparser/SyntaxTest.scala +++ b/scalatexApi/src/test/scala/scalaparser/SyntaxTest.scala @@ -218,10 +218,69 @@ object SyntaxTest extends TestSuite{ |} """.stripMargin ) + * - check( + """/* __ *\ + |** ________ ___ / / ___ __ ____ Scala.js CLI ** + |** / __/ __// _ | / / / _ | __ / // __/ (c) 2013-2014, LAMP/EPFL ** + |** __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \ http://scala-js.org/ ** + |** /____/\___/_/ |_/____/_/ | |__/ /____/ ** + |** |/____/ ** + |\* */ + | + |package scala.scalajs.cli + | + """.stripMargin + ) + * - check( + """ + |object O{ + | for { + | a <- b + | c <- d + | } { + | 1 + | } + |} + """.stripMargin + ) + * - check( + """ + |object O{ + | val jarFile = + | try { 1 } + | catch { case _: F => G } + |} + """.stripMargin + ) + * - check( + """ + |object F{ + | func{ case _: F => fail } + |} + """.stripMargin + ) + * - check( + """ + |object SyntaxTest extends TestSuite{ + | def check[T](input: String) = { + | new ScalaSyntax(input).CompilationUnit.run() match{ + | case Failure(f: ParseError) => + | println(f.position) + | println(f.formatExpectedAsString) + | println(f.formatTraces) + | throw new Exception(f.position + "\t" + f.formatTraces) + | case Success(parsed) => + | assert(parsed == input) + | } + | } + |} + """.stripMargin + ) + } - println("Checking") + def checkFile(path: String) = check(io.Source.fromFile(path).mkString) 'file{ - def checkFile(path: String) = check(io.Source.fromFile(path).mkString) + * - checkFile("scalatexApi/src/main/scala/scalaparser/syntax/Basic.scala") * - checkFile("scalatexApi/src/main/scala/scalaparser/syntax/Identifiers.scala") @@ -243,6 +302,17 @@ object SyntaxTest extends TestSuite{ * - checkFile("scalatexPlugin/src/main/scala/scalatex/ScalaTexPlugin.scala") } - } + 'omg{ + val root = new java.io.File("../scala-js/") + def listFiles(s: java.io.File): Iterator[String] = { + val (dirs, files) = s.listFiles().toIterator.partition(_.isDirectory) + files.map(_.getPath) ++ dirs.flatMap(listFiles) + } + for(f <- listFiles(root).filter(_.endsWith(".scala"))){ + println("CHECKING " + f) + checkFile(f) + } + } + } } |