diff options
author | Micro Dotta <mirco.dotta@gmail.com> | 2011-11-01 10:45:11 +0000 |
---|---|---|
committer | Micro Dotta <mirco.dotta@gmail.com> | 2011-11-01 10:45:11 +0000 |
commit | 69b3cd50923b3f495f1e421e8a4ac505044f3c40 (patch) | |
tree | dd535d58c77bd70b85302abdebc459c1d412e563 /src | |
parent | 934f8015a2e55bc9bfd1f50c274becf755c0d27b (diff) | |
download | scala-69b3cd50923b3f495f1e421e8a4ac505044f3c40.tar.gz scala-69b3cd50923b3f495f1e421e8a4ac505044f3c40.tar.bz2 scala-69b3cd50923b3f495f1e421e8a4ac505044f3c40.zip |
Made some minor change in the presentation comp...
Made some minor change in the presentation compiler testing framework to
make it more robust when (unexpected) NoPosition values are returned.
That makes test failure smoother and more information can be hence
gathered from the logged trace. no review.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/tests/core/PresentationCompilerTestDef.scala | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala index 8d9c545e93..c53247c054 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/core/CoreTestDefs.scala @@ -29,7 +29,7 @@ private[tests] trait CoreTestDefs askCompletionAt(pos) } { (pos, members) => withResponseDelimiter { - reporter.println("[response] aksTypeCompletion at (%s,%s)".format(pos.line, pos.column)) + reporter.println("[response] aksTypeCompletion at " + format(pos)) // we skip getClass because it changed signature between 1.5 and 1.6, so there is no // universal check file that we can provide for this to work reporter.println("retrieved %d members".format(members.size)) @@ -55,7 +55,7 @@ private[tests] trait CoreTestDefs askTypeAt(pos) } { (pos, tree) => withResponseDelimiter { - reporter.println("[response] askTypeAt at " + (pos.line, pos.column)) + reporter.println("[response] askTypeAt at " + format(pos)) compiler.ask(() => reporter.println(tree)) } } @@ -79,7 +79,7 @@ private[tests] trait CoreTestDefs reporter.println("\nNo symbol is associated with tree: "+tree) } else { - reporter.println("\naskHyperlinkPos for `" + tree.symbol.name + "` at " + ((pos.line, pos.column)) + " " + pos.source.file.name) + reporter.println("\naskHyperlinkPos for `" + tree.symbol.name + "` at " + format(pos) + " " + tree.symbol.sourceFile.name) val r = new Response[Position] val sourceFile = sourceFiles.find(tree.symbol.sourceFile.path == _.path) match { case Some(source) => @@ -87,7 +87,7 @@ private[tests] trait CoreTestDefs r.get match { case Left(pos) => withResponseDelimiter { - reporter.println("[response] found askHyperlinkPos for `" + tree.symbol.name + "` at " + (pos.line, pos.column) + " " + tree.symbol.sourceFile.name) + reporter.println("[response] found askHyperlinkPos for `" + tree.symbol.name + "` at " + format(pos) + " " + tree.symbol.sourceFile.name) } case Right(ex) => ex.printStackTrace() diff --git a/src/compiler/scala/tools/nsc/interactive/tests/core/PresentationCompilerTestDef.scala b/src/compiler/scala/tools/nsc/interactive/tests/core/PresentationCompilerTestDef.scala index a9fd7444c1..390363eca8 100644 --- a/src/compiler/scala/tools/nsc/interactive/tests/core/PresentationCompilerTestDef.scala +++ b/src/compiler/scala/tools/nsc/interactive/tests/core/PresentationCompilerTestDef.scala @@ -1,7 +1,12 @@ package scala.tools.nsc.interactive.tests.core +import scala.tools.nsc.interactive.Global +import scala.tools.nsc.util.Position + trait PresentationCompilerTestDef { + def compiler: Global + protected val marker: TestMarker private[tests] def runTest(): Unit @@ -12,4 +17,7 @@ trait PresentationCompilerTestDef { block printDelimiter() } + + protected def format(pos: Position): String = + (if(pos.isDefined) "(%d,%d)".format(pos.line, pos.column) else "<no position>") }
\ No newline at end of file |