From 1706358bdcf0492b82e87c8f34e9b7120348df8b Mon Sep 17 00:00:00 2001 From: Micro Dotta Date: Sun, 9 Oct 2011 20:55:55 +0000 Subject: Minor update of the PC's testing framework. --- .../scala/tools/nsc/interactive/tests/InteractiveTest.scala | 13 +++++++------ .../scala/tools/nsc/interactive/tests/core/AskCommand.scala | 13 ++++++++++++- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala index 3bad2d0962..7be115e777 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/InteractiveTest.scala @@ -54,6 +54,7 @@ abstract class InteractiveTest extends AskParse with AskShutdown with AskReload + with AskLoadedTyped with PresentationCompilerInstance with CoreTestDefs with InteractiveTestSettings { self => @@ -83,11 +84,6 @@ abstract class InteractiveTest loadSources() runTests() shutdown() - - // this is actually needed to force exit on test completion. - // Note: May be a bug on either the testing framework or (less likely) - // the presentation compiler - sys.exit(0) } /** Load all sources before executing the test. */ @@ -118,7 +114,12 @@ abstract class InteractiveTest } /** shutdown the presentation compiler. */ - private def shutdown() { + protected def shutdown() { askShutdown() + + // this is actually needed to force exit on test completion. + // Note: May be a bug on either the testing framework or (less likely) + // the presentation compiler + sys.exit(0) } } \ No newline at end of file diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala index b65d069d94..35d6723818 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/core/AskCommand.scala @@ -61,7 +61,7 @@ trait AskParse extends AskCommand { trait AskReload extends AskCommand { /** Reload the given source files and wait for them to be reloaded. */ - private[tests] def askReload(sources: Seq[SourceFile])(implicit reporter: Reporter): Response[Unit] = { + protected def askReload(sources: Seq[SourceFile])(implicit reporter: Reporter): Response[Unit] = { val sortedSources = (sources map (_.file.name)).sorted reporter.println("reload: " + sortedSources.mkString(", ")) @@ -113,3 +113,14 @@ trait AskType extends AskCommand { } } + +trait AskLoadedTyped extends AskCommand { + import compiler.Tree + + protected def askLoadedTyped(source: SourceFile)(implicit reporter: Reporter): Response[Tree] = { + ask { + compiler.askLoadedTyped(source, _) + } + } + +} -- cgit v1.2.3