summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-09-26 07:43:48 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-09-27 15:49:01 +0200
commitca9d2149e964604daf3a8d88d6946217ef90c643 (patch)
tree0d285f2f1a28382be9a43cddd8d148a73b7422f5 /test/files/run
parent7911f9e85b3798d449d6b551d7c8be15cc63f240 (diff)
downloadscala-ca9d2149e964604daf3a8d88d6946217ef90c643.tar.gz
scala-ca9d2149e964604daf3a8d88d6946217ef90c643.tar.bz2
scala-ca9d2149e964604daf3a8d88d6946217ef90c643.zip
removes front ends from scala-reflect.jar
It was an interesting idea to give macro developers control over front ends, but it hasn't given any visible results. To the contrast, front ends have proven useful for toolboxes to easily control what errors get printed where. Therefore I'm moving front ends to scala-compiler.jar to clean up the API. Yay for scaladoc-driven development!
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/toolbox_console_reporter.check8
-rw-r--r--test/files/run/toolbox_console_reporter.scala35
-rw-r--r--test/files/run/toolbox_silent_reporter.scala4
3 files changed, 34 insertions, 13 deletions
diff --git a/test/files/run/toolbox_console_reporter.check b/test/files/run/toolbox_console_reporter.check
index e69de29bb2..1395c68740 100644
--- a/test/files/run/toolbox_console_reporter.check
+++ b/test/files/run/toolbox_console_reporter.check
@@ -0,0 +1,8 @@
+hello
+============compiler console=============
+warning: method foo in object Utils is deprecated: test
+
+=========================================
+============compiler messages============
+Info(NoPosition,method foo in object Utils is deprecated: test,WARNING)
+=========================================
diff --git a/test/files/run/toolbox_console_reporter.scala b/test/files/run/toolbox_console_reporter.scala
index a57dea38a8..d672ccb9cb 100644
--- a/test/files/run/toolbox_console_reporter.scala
+++ b/test/files/run/toolbox_console_reporter.scala
@@ -1,16 +1,29 @@
import scala.reflect.runtime.universe._
+import scala.reflect.runtime.{universe => ru}
+import scala.reflect.runtime.{currentMirror => cm}
+import scala.tools.reflect.{ToolBox, mkConsoleFrontEnd}
object Test extends App {
- // todo. cannot test this unfortunately, because ConsoleFrontEnd grabs Console.out too early
- // todo. and isn't affected by Console.setOut employed by partest to intercept output
+ val oldErr = Console.err;
+ val baos = new java.io.ByteArrayOutputStream();
+ Console.setErr(new java.io.PrintStream(baos));
+ try {
+ val toolbox = cm.mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation")
+ toolbox.eval(reify{
+ object Utils {
+ @deprecated("test", "2.10.0")
+ def foo { println("hello") }
+ }
- //val toolbox = mkToolBox(frontEnd = mkConsoleFrontEnd(), options = "-deprecation")
- //toolbox.eval(reify{
- // object Utils {
- // @deprecated("test", "2.10.0")
- // def foo { println("hello") }
- // }
- //
- // Utils.foo
- //})
+ Utils.foo
+ }.tree)
+ println("============compiler console=============")
+ println(baos.toString);
+ println("=========================================")
+ println("============compiler messages============")
+ toolbox.frontEnd.infos.foreach(println(_))
+ println("=========================================")
+ } finally {
+ Console.setErr(oldErr);
+ }
} \ No newline at end of file
diff --git a/test/files/run/toolbox_silent_reporter.scala b/test/files/run/toolbox_silent_reporter.scala
index 15f559d605..03b1d6defa 100644
--- a/test/files/run/toolbox_silent_reporter.scala
+++ b/test/files/run/toolbox_silent_reporter.scala
@@ -1,10 +1,10 @@
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{universe => ru}
import scala.reflect.runtime.{currentMirror => cm}
-import scala.tools.reflect.ToolBox
+import scala.tools.reflect.{ToolBox, mkSilentFrontEnd}
object Test extends App {
- val toolbox = cm.mkToolBox(options = "-deprecation")
+ val toolbox = cm.mkToolBox(options = "-deprecation", frontEnd = mkSilentFrontEnd())
toolbox.eval(reify{
object Utils {
@deprecated("test", "2.10.0")