aboutsummaryrefslogtreecommitdiff
path: root/tests/pending/run/global-showdef.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-05-12 18:30:53 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-05-12 18:30:53 +0200
commit89bacb9c25a58454ff1878e67f7ea07ffc8c269f (patch)
tree51f1ff6c66aebe1b6109b1cffcc2bb8e4cf760a3 /tests/pending/run/global-showdef.scala
parenta0fa33deafbea1bf53edc068c5ed9db5592822f9 (diff)
downloaddotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.gz
dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.bz2
dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.zip
Run tests as they were in scala.
Diffstat (limited to 'tests/pending/run/global-showdef.scala')
-rw-r--r--tests/pending/run/global-showdef.scala58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/pending/run/global-showdef.scala b/tests/pending/run/global-showdef.scala
new file mode 100644
index 000000000..276fcc1e7
--- /dev/null
+++ b/tests/pending/run/global-showdef.scala
@@ -0,0 +1,58 @@
+import scala.tools.partest.DirectTest
+import scala.tools.nsc.util.stringFromStream
+
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp -Yshow:typer -Ystop-after: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.zipAll(objects, "", "") foreach {
+ case (c, "") => run("-Xshow-class", c)
+ case (c, o) => run("-Xshow-class", c, "-Xshow-object", o)
+ }
+ }
+
+ // slurp the compilation result
+ def slurp(args: String*): String = stringFromStream { stream =>
+ Console.withOut(stream) {
+ Console.withErr(stream) {
+ compile(args: _*)
+ }
+ }
+ }
+}