blob: bbad123d01e4ccbcc364b391295273c4f8f7444a (
plain) (
tree)
|
|
import scala.tools.partest.DirectTest
import scala.tools.nsc.util.stringFromStream
object Test extends DirectTest {
override def extraSettings: String = "-usejavacp -Yshow:typer"
override def code = """
package foo.bar
class Bippy {
type BippyType <: {
def showdefTestMemberType1: Unit
}
def showdefTestMemberClass1 = 5
class Boppity {
def showdefTestMemberClass2 = 5
class Boo {
def showdefTestMemberClass3 = 5
}
object Boo {
def showdefTestMemberObject1 = "abc"
}
}
}
object Bippy {
type BippyType <: {
def showdefTestMemberType2: Unit
}
def showdefTestMemberObject2 = "abc"
}
"""
override def show(): Unit = {
val classes = List("Bippy", "Bippy#BippyType", "Bippy.BippyType", "Bippy#Boppity", "Bippy#Boppity#Boo")
val objects = List("Bippy", "Bippy#Boppity#Boo")
def interesting(line: String) = (line contains "def showdefTestMember") || (line startsWith "<<-- ")
def run(args: String*) = slurp(args: _*).lines filter interesting foreach println
classes foreach (x => run("-Xshow-class", x))
objects foreach (x => run("-Xshow-object", x))
}
// slurp the compilation result
def slurp(args: String*): String = stringFromStream { stream =>
Console.withOut(stream) {
Console.withErr(stream) {
compile(args: _*)
}
}
}
}
|