aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-11-02 11:08:28 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-11-22 01:35:07 +0100
commit8a61ff432543a29234193cd1f7c14abd3f3d31a0 (patch)
treea8147561d307af862c295cfc8100d271063bb0dd /compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala
parent6a455fe6da5ff9c741d91279a2dc6fe2fb1b472f (diff)
downloaddotty-8a61ff432543a29234193cd1f7c14abd3f3d31a0.tar.gz
dotty-8a61ff432543a29234193cd1f7c14abd3f3d31a0.tar.bz2
dotty-8a61ff432543a29234193cd1f7c14abd3f3d31a0.zip
Move compiler and compiler tests to compiler dir
Diffstat (limited to 'compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala')
-rw-r--r--compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala65
1 files changed, 65 insertions, 0 deletions
diff --git a/compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala b/compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala
new file mode 100644
index 000000000..b024a63db
--- /dev/null
+++ b/compiler/test/dotty/tools/dotc/parsing/ScannerTest.scala
@@ -0,0 +1,65 @@
+package dotty.tools
+package dotc
+package parsing
+
+import scala.reflect.io._
+import scala.io.Codec
+import util._
+import Tokens._, Scanners._
+import org.junit.Test
+
+class ScannerTest extends DottyTest {
+
+ val blackList = List(
+ "/scaladoc/scala/tools/nsc/doc/html/page/Index.scala",
+ "/scaladoc/scala/tools/nsc/doc/html/page/Template.scala"
+ )
+
+ def scan(name: String): Unit = scan(new PlainFile(name))
+
+ def scan(file: PlainFile): Unit = {
+ //println("***** scanning " + file)
+ val source = new SourceFile(file, Codec.UTF8)
+ val scanner = new Scanner(source)
+ var i = 0
+ while (scanner.token != EOF) {
+// print("[" + scanner.token.show +"]")
+ scanner.nextToken
+// i += 1
+// if (i % 10 == 0) println()
+ }
+ }
+
+ def scanDir(path: String): Unit = scanDir(Directory(path))
+
+ def scanDir(dir: Directory): Unit = {
+ if (blackList exists (dir.jfile.toString endsWith _))
+ println(s"blacklisted package: ${dir.jfile.getAbsolutePath}")
+ else
+ for (f <- dir.files)
+ if (f.name.endsWith(".scala"))
+ if (blackList exists (f.jfile.toString endsWith _))
+ println(s"blacklisted file: ${f.jfile.getAbsolutePath}")
+ else
+ scan(new PlainFile(f))
+ for (d <- dir.dirs)
+ scanDir(d.path)
+ }
+
+ @Test
+ def scanList() = {
+ println(System.getProperty("user.dir"))
+ scan("./src/dotty/tools/dotc/core/Symbols.scala")
+ scan("./src/dotty/tools/dotc/core/Symbols.scala")
+ }
+
+ @Test
+ def scanDotty() = {
+ scanDir("src")
+ }
+
+ @Test
+ def scanScala() = {
+ scanDir("../scala-scala/src")
+ }
+}