Permalink
Browse files

Presentation Compiler tests for visibility of members.

Removed some unneeded indirection in the testing framework.
  • Loading branch information...
dragos committed Apr 30, 2012
1 parent 94c63f5 commit b72f52bbd59602ec9e09900381d5ff19752fa961
@@ -17,15 +17,11 @@ private[tests] trait CoreTestDefs
extends PresentationCompilerTestDef
with AskCompletionAt {
- object MemberPrinter {
- def apply(member: compiler.Member): String =
- "`" + (member.sym.toString() + member.tpe.toString()).trim() + "`"
- }
-
- protected val marker = CompletionMarker
+ def memberPrinter(member: compiler.Member): String =
+ "[accessible: %5s] ".format(member.accessible) + "`" + (member.sym.toString() + member.tpe.toString()).trim() + "`"
override def runTest() {
- askAllSources(marker) { pos =>
+ askAllSources(CompletionMarker) { pos =>
askCompletionAt(pos)
} { (pos, members) =>
withResponseDelimiter {
@@ -35,7 +31,7 @@ private[tests] trait CoreTestDefs
reporter.println("retrieved %d members".format(members.size))
compiler ask { () =>
val filtered = members.filterNot(member => member.sym.name.toString == "getClass" || member.sym.isConstructor)
- reporter.println(filtered.map(MemberPrinter(_)).sortBy(_.toString()).mkString("\n"))
+ reporter.println(filtered.map(memberPrinter).sortBy(_.toString()).mkString("\n"))
}
}
}
@@ -48,10 +44,8 @@ private[tests] trait CoreTestDefs
extends PresentationCompilerTestDef
with AskTypeAt {
- protected val marker = TypeMarker
-
override def runTest() {
- askAllSources(marker) { pos =>
+ askAllSources(TypeMarker) { pos =>
askTypeAt(pos)
} { (pos, tree) =>
withResponseDelimiter {
@@ -69,10 +63,8 @@ private[tests] trait CoreTestDefs
with AskTypeAt
with AskCompletionAt {
- protected val marker = HyperlinkMarker
-
override def runTest() {
- askAllSources(marker) { pos =>
+ askAllSources(HyperlinkMarker) { pos =>
askTypeAt(pos)(NullReporter)
} { (pos, tree) =>
if(tree.symbol == compiler.NoSymbol) {
@@ -5,10 +5,6 @@ import scala.tools.nsc.util.Position
trait PresentationCompilerTestDef {
- def compiler: Global
-
- protected val marker: TestMarker
-
private[tests] def runTest(): Unit
protected def withResponseDelimiter(block: => Unit)(implicit reporter: Reporter) {
@@ -4,66 +4,66 @@ askTypeCompletion at CallccInterpreter.scala(51,38)
================================================================================
[response] aksTypeCompletion at (51,38)
retrieved 64 members
-`class AddcallccInterpreter.Add`
-`class AppcallccInterpreter.App`
-`class CcccallccInterpreter.Ccc`
-`class ConcallccInterpreter.Con`
-`class FuncallccInterpreter.Fun`
-`class LamcallccInterpreter.Lam`
-`class McallccInterpreter.M`
-`class NumcallccInterpreter.Num`
-`class VarcallccInterpreter.Var`
-`method !=(x$1: Any)Boolean`
-`method !=(x$1: AnyRef)Boolean`
-`method ##()Int`
-`method +(other: String)String`
-`method ->[B](y: B)(callccInterpreter.type, B)`
-`method ==(x$1: Any)Boolean`
-`method ==(x$1: AnyRef)Boolean`
-`method add(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[_ >: callccInterpreter.Num with callccInterpreter.Wrong.type <: Product with Serializable with callccInterpreter.Value]`
-`method apply(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[callccInterpreter.Value]`
-`method asInstanceOf[T0]=> T0`
-`method callCC[A](h: (A => callccInterpreter.M[A]) => callccInterpreter.M[A])callccInterpreter.M[A]`
-`method clone()Object`
-`method ensuring(cond: Boolean)callccInterpreter.type`
-`method ensuring(cond: Boolean, msg: => Any)callccInterpreter.type`
-`method ensuring(cond: callccInterpreter.type => Boolean)callccInterpreter.type`
-`method ensuring(cond: callccInterpreter.type => Boolean, msg: => Any)callccInterpreter.type`
-`method eq(x$1: AnyRef)Boolean`
-`method equals(x$1: Any)Boolean`
-`method finalize()Unit`
-`method formatted(fmtstr: String)String`
-`method hashCode()Int`
-`method id[A]=> A => A`
-`method interp(t: callccInterpreter.Term, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]`
-`method isInstanceOf[T0]=> Boolean`
-`method lookup(x: callccInterpreter.Name, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]`
-`method main(args: Array[String])Unit`
-`method ne(x$1: AnyRef)Boolean`
-`method notify()Unit`
-`method notifyAll()Unit`
-`method showM(m: callccInterpreter.M[callccInterpreter.Value])String`
-`method synchronized[T0](x$1: T0)T0`
-`method test(t: callccInterpreter.Term)String`
-`method toString()String`
-`method unitM[A](a: A)callccInterpreter.M[A]`
-`method wait()Unit`
-`method wait(x$1: Long)Unit`
-`method wait(x$1: Long, x$2: Int)Unit`
-`method x=> callccInterpreter.type`
-`method →[B](y: B)(callccInterpreter.type, B)`
-`object WrongcallccInterpreter.Wrong.type`
-`trait TermcallccInterpreter.Term`
-`trait ValuecallccInterpreter.Value`
-`type AnswercallccInterpreter.Answer`
-`type EnvironmentcallccInterpreter.Environment`
-`type NamecallccInterpreter.Name`
-`value __leftOfArrowcallccInterpreter.type`
-`value __resultOfEnsuringcallccInterpreter.type`
-`value selfAny`
-`value term0callccInterpreter.App`
-`value term1callccInterpreter.App`
-`value term2callccInterpreter.Add`
+[accessible: true] `class AddcallccInterpreter.Add`
+[accessible: true] `class AppcallccInterpreter.App`
+[accessible: true] `class CcccallccInterpreter.Ccc`
+[accessible: true] `class ConcallccInterpreter.Con`
+[accessible: true] `class FuncallccInterpreter.Fun`
+[accessible: true] `class LamcallccInterpreter.Lam`
+[accessible: true] `class McallccInterpreter.M`
+[accessible: true] `class NumcallccInterpreter.Num`
+[accessible: true] `class VarcallccInterpreter.Var`
+[accessible: true] `method !=(x$1: Any)Boolean`
+[accessible: true] `method !=(x$1: AnyRef)Boolean`
+[accessible: true] `method ##()Int`
+[accessible: true] `method +(other: String)String`
+[accessible: true] `method ->[B](y: B)(callccInterpreter.type, B)`
+[accessible: true] `method ==(x$1: Any)Boolean`
+[accessible: true] `method ==(x$1: AnyRef)Boolean`
+[accessible: true] `method add(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[_ >: callccInterpreter.Num with callccInterpreter.Wrong.type <: Product with Serializable with callccInterpreter.Value]`
+[accessible: true] `method apply(a: callccInterpreter.Value, b: callccInterpreter.Value)callccInterpreter.M[callccInterpreter.Value]`
+[accessible: true] `method asInstanceOf[T0]=> T0`
+[accessible: true] `method callCC[A](h: (A => callccInterpreter.M[A]) => callccInterpreter.M[A])callccInterpreter.M[A]`
+[accessible: true] `method clone()Object`
+[accessible: true] `method ensuring(cond: Boolean)callccInterpreter.type`
+[accessible: true] `method ensuring(cond: Boolean, msg: => Any)callccInterpreter.type`
+[accessible: true] `method ensuring(cond: callccInterpreter.type => Boolean)callccInterpreter.type`
+[accessible: true] `method ensuring(cond: callccInterpreter.type => Boolean, msg: => Any)callccInterpreter.type`
+[accessible: true] `method eq(x$1: AnyRef)Boolean`
+[accessible: true] `method equals(x$1: Any)Boolean`
+[accessible: true] `method finalize()Unit`
+[accessible: true] `method formatted(fmtstr: String)String`
+[accessible: true] `method hashCode()Int`
+[accessible: true] `method id[A]=> A => A`
+[accessible: true] `method interp(t: callccInterpreter.Term, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]`
+[accessible: true] `method isInstanceOf[T0]=> Boolean`
+[accessible: true] `method lookup(x: callccInterpreter.Name, e: callccInterpreter.Environment)callccInterpreter.M[callccInterpreter.Value]`
+[accessible: true] `method main(args: Array[String])Unit`
+[accessible: true] `method ne(x$1: AnyRef)Boolean`
+[accessible: true] `method notify()Unit`
+[accessible: true] `method notifyAll()Unit`
+[accessible: true] `method showM(m: callccInterpreter.M[callccInterpreter.Value])String`
+[accessible: true] `method synchronized[T0](x$1: T0)T0`
+[accessible: true] `method test(t: callccInterpreter.Term)String`
+[accessible: true] `method toString()String`
+[accessible: true] `method unitM[A](a: A)callccInterpreter.M[A]`
+[accessible: true] `method wait()Unit`
+[accessible: true] `method wait(x$1: Long)Unit`
+[accessible: true] `method wait(x$1: Long, x$2: Int)Unit`
+[accessible: true] `method x=> callccInterpreter.type`
+[accessible: true] `method →[B](y: B)(callccInterpreter.type, B)`
+[accessible: true] `object WrongcallccInterpreter.Wrong.type`
+[accessible: true] `trait TermcallccInterpreter.Term`
+[accessible: true] `trait ValuecallccInterpreter.Value`
+[accessible: true] `type AnswercallccInterpreter.Answer`
+[accessible: true] `type EnvironmentcallccInterpreter.Environment`
+[accessible: true] `type NamecallccInterpreter.Name`
+[accessible: true] `value term0callccInterpreter.App`
+[accessible: true] `value term1callccInterpreter.App`
+[accessible: true] `value term2callccInterpreter.Add`
+[accessible: false] `value __leftOfArrowcallccInterpreter.type`
+[accessible: false] `value __resultOfEnsuringcallccInterpreter.type`
+[accessible: false] `value selfAny`
================================================================================
askType at CallccInterpreter.scala(14,21)
@@ -4,37 +4,37 @@ askTypeCompletion at CompletionOnEmptyArgMethod.scala(2,17)
================================================================================
[response] aksTypeCompletion at (2,17)
retrieved 37 members
-`method !=(x$1: Any)Boolean`
-`method !=(x$1: AnyRef)Boolean`
-`method ##()Int`
-`method +(other: String)String`
-`method ->[B](y: B)(Foo, B)`
-`method ==(x$1: Any)Boolean`
-`method ==(x$1: AnyRef)Boolean`
-`method asInstanceOf[T0]=> T0`
-`method clone()Object`
-`method ensuring(cond: Boolean)Foo`
-`method ensuring(cond: Boolean, msg: => Any)Foo`
-`method ensuring(cond: Foo => Boolean)Foo`
-`method ensuring(cond: Foo => Boolean, msg: => Any)Foo`
-`method eq(x$1: AnyRef)Boolean`
-`method equals(x$1: Any)Boolean`
-`method finalize()Unit`
-`method foo=> Foo`
-`method formatted(fmtstr: String)String`
-`method hashCode()Int`
-`method isInstanceOf[T0]=> Boolean`
-`method ne(x$1: AnyRef)Boolean`
-`method notify()Unit`
-`method notifyAll()Unit`
-`method synchronized[T0](x$1: T0)T0`
-`method toString()String`
-`method wait()Unit`
-`method wait(x$1: Long)Unit`
-`method wait(x$1: Long, x$2: Int)Unit`
-`method x=> Foo`
-`method →[B](y: B)(Foo, B)`
-`value __leftOfArrowFoo`
-`value __resultOfEnsuringFoo`
-`value selfAny`
-================================================================================
+[accessible: true] `method !=(x$1: Any)Boolean`
+[accessible: true] `method !=(x$1: AnyRef)Boolean`
+[accessible: true] `method ##()Int`
+[accessible: true] `method +(other: String)String`
+[accessible: true] `method ->[B](y: B)(Foo, B)`
+[accessible: true] `method ==(x$1: Any)Boolean`
+[accessible: true] `method ==(x$1: AnyRef)Boolean`
+[accessible: true] `method asInstanceOf[T0]=> T0`
+[accessible: true] `method clone()Object`
+[accessible: true] `method ensuring(cond: Boolean)Foo`
+[accessible: true] `method ensuring(cond: Boolean, msg: => Any)Foo`
+[accessible: true] `method ensuring(cond: Foo => Boolean)Foo`
+[accessible: true] `method ensuring(cond: Foo => Boolean, msg: => Any)Foo`
+[accessible: true] `method eq(x$1: AnyRef)Boolean`
+[accessible: true] `method equals(x$1: Any)Boolean`
+[accessible: true] `method finalize()Unit`
+[accessible: true] `method foo=> Foo`
+[accessible: true] `method formatted(fmtstr: String)String`
+[accessible: true] `method hashCode()Int`
+[accessible: true] `method isInstanceOf[T0]=> Boolean`
+[accessible: true] `method ne(x$1: AnyRef)Boolean`
+[accessible: true] `method notify()Unit`
+[accessible: true] `method notifyAll()Unit`
+[accessible: true] `method synchronized[T0](x$1: T0)T0`
+[accessible: true] `method toString()String`
+[accessible: true] `method wait()Unit`
+[accessible: true] `method wait(x$1: Long)Unit`
+[accessible: true] `method wait(x$1: Long, x$2: Int)Unit`
+[accessible: true] `method x=> Foo`
+[accessible: true] `method →[B](y: B)(Foo, B)`
+[accessible: false] `value __leftOfArrowFoo`
+[accessible: false] `value __resultOfEnsuringFoo`
+[accessible: false] `value selfAny`
+================================================================================
Oops, something went wrong.

0 comments on commit b72f52b

Please sign in to comment.