diff options
Diffstat (limited to 'test/disabled/presentation/doc/doc.scala')
-rwxr-xr-x | test/disabled/presentation/doc/doc.scala | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/test/disabled/presentation/doc/doc.scala b/test/disabled/presentation/doc/doc.scala index 371b825026..f2233f1828 100755 --- a/test/disabled/presentation/doc/doc.scala +++ b/test/disabled/presentation/doc/doc.scala @@ -1,9 +1,9 @@ +import scala.reflect.internal.util.{ BatchSourceFile, SourceFile } import scala.tools.nsc.doc import scala.tools.nsc.doc.base._ import scala.tools.nsc.doc.base.comment._ import scala.tools.nsc.interactive._ import scala.tools.nsc.interactive.tests._ -import scala.tools.nsc.util._ object Test extends InteractiveTest { val tags = Seq( @@ -37,12 +37,20 @@ object Test extends InteractiveTest { prepre + docComment(nTags) + prepost + post } - - override lazy val compiler = { prepareSettings(settings) - new Global(settings, compilerReporter) with MemberLookupBase with CommentFactoryBase { + new Global(settings, compilerReporter) with MemberLookupBase with CommentFactoryBase with doc.ScaladocGlobalTrait { + outer => + val global: this.type = this + + override lazy val analyzer = new { + val global: outer.type = outer + } with doc.ScaladocAnalyzer with InteractiveAnalyzer { + override def newTyper(context: Context): InteractiveTyper with ScaladocTyper = + new Typer(context) with InteractiveTyper with ScaladocTyper + } + def chooseLink(links: List[LinkTo]): LinkTo = links.head def internalLink(sym: Symbol, site: Symbol) = None def toString(link: LinkTo) = link.toString @@ -59,7 +67,7 @@ object Test extends InteractiveTest { if (expanded.isEmpty) None else - Some(ask { () => parseAtSymbol(expanded, raw, pos, Some(sym.owner)) }) + Some(ask { () => parseAtSymbol(expanded, raw, pos, sym.owner) }) } } } @@ -88,12 +96,11 @@ object Test extends InteractiveTest { println("Couldn't parse") case Some(_) => val sym = compiler.ask { () => - val toplevel = definitions.EmptyPackage.info.decl(newTypeName(name)) + val toplevel = compiler.rootMirror.EmptyPackage.info.decl(TypeName(name)) if (toplevel eq NoSymbol) { - val clazz = definitions.EmptyPackage.info.decl(newTypeName(className)) - - val term = clazz.info.decl(newTermName(name)) - if (term eq NoSymbol) clazz.info.decl(newTypeName(name)) else + val clazz = compiler.rootMirror.EmptyPackage.info.decl(TypeName(className)) + val term = clazz.info.decl(TermName(name)) + if (term eq NoSymbol) clazz.info.decl(TypeName(name)) else if (term.isAccessor) term.accessed else term } else toplevel } @@ -115,16 +122,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")) + val (derived, base) = compiler.ask { () => + val derived = compiler.rootMirror.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 { () => @@ -133,7 +141,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) } } |