diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-29 03:30:25 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-03-29 03:30:25 -0700 |
commit | 1debc74374e9c3de52d1333b695db61e7a69a57b (patch) | |
tree | 8700ca46746ef1a20970a61c67f9e7e7da931cd4 | |
parent | 8e64b165d8b09571f290c456794091ff5190ab90 (diff) | |
parent | 74de4ba0a295db8754d0aee12c01d51af0d12d8b (diff) | |
download | scala-1debc74374e9c3de52d1333b695db61e7a69a57b.tar.gz scala-1debc74374e9c3de52d1333b695db61e7a69a57b.tar.bz2 scala-1debc74374e9c3de52d1333b695db61e7a69a57b.zip |
Merge pull request #2316 from vigdorchik/interactive_test_framework
Improve testing interactive experience.
4 files changed, 7 insertions, 16 deletions
diff --git a/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala b/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala index a4a2de9b51..f30d896fb7 100644 --- a/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala +++ b/src/interactive/scala/tools/nsc/interactive/tests/InteractiveTest.scala @@ -74,7 +74,7 @@ abstract class InteractiveTest /** Test's entry point */ def main(args: Array[String]) { try execute() - finally shutdown() + finally askShutdown() } protected def execute(): Unit = { @@ -110,14 +110,4 @@ abstract class InteractiveTest tester.run() } ****/ - - /** shutdown the presentation compiler. */ - 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) - } } diff --git a/src/interactive/scala/tools/nsc/interactive/tests/core/SourcesCollector.scala b/src/interactive/scala/tools/nsc/interactive/tests/core/SourcesCollector.scala index 676feeba8a..40cfc111a1 100644 --- a/src/interactive/scala/tools/nsc/interactive/tests/core/SourcesCollector.scala +++ b/src/interactive/scala/tools/nsc/interactive/tests/core/SourcesCollector.scala @@ -11,7 +11,7 @@ private[tests] object SourcesCollector { * With the default `filter` only .scala and .java files are collected. * */ def apply(base: Path, filter: SourceFilter): Array[SourceFile] = { - assert(base.isDirectory) + assert(base.isDirectory, base + " is not a directory") base.walk.filter(filter).map(source).toList.toArray.sortBy(_.file.name) } diff --git a/test/files/presentation/doc/doc.scala b/test/files/presentation/doc/doc.scala index 7a2eb9a588..916b7832f4 100755 --- a/test/files/presentation/doc/doc.scala +++ b/test/files/presentation/doc/doc.scala @@ -127,16 +127,17 @@ object Test extends InteractiveTest { val baseSource = findSource("Base.scala") val derivedSource = findSource("Derived.scala") def existsText(where: Any, text: String): Boolean = where match { - case `text` => true + case s: String => s contains text case s: Seq[_] => s exists (existsText(_, text)) case p: Product => p.productIterator exists (existsText(_, text)) + case c: Comment => existsText(c.body, text) } val (derived, base) = compiler.ask { () => val derived = definitions.RootPackage.info.decl(newTermName("p")).info.decl(newTypeName("Derived")) (derived, derived.ancestors(0)) } val cmt1 = getComment(derived, derivedSource, (base, baseSource)::(derived, derivedSource)::Nil) - if (!existsText(cmt1, "Derived comment.")) + if (!existsText(cmt1, "This is Derived comment")) println("Unexpected Derived class comment:"+cmt1) val (fooDerived, fooBase) = compiler.ask { () => @@ -145,7 +146,7 @@ object Test extends InteractiveTest { } val cmt2 = getComment(fooDerived, derivedSource, (fooBase, baseSource)::(fooDerived, derivedSource)::Nil) - if (!existsText(cmt2, "Base method has documentation.")) + if (!existsText(cmt2, "Base method has documentation")) println("Unexpected foo method comment:"+cmt2) } } diff --git a/test/files/presentation/doc/src/p/Base.scala b/test/files/presentation/doc/src/p/Base.scala index 9031de3e3e..d91632b6f6 100755 --- a/test/files/presentation/doc/src/p/Base.scala +++ b/test/files/presentation/doc/src/p/Base.scala @@ -1,7 +1,7 @@ package p /** - * @define BaseComment $BaseVar comment. + * @define BaseComment This is $BaseVar comment. */ trait Base { /** |