aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/test/dotty/tools')
-rw-r--r--compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala30
-rw-r--r--compiler/test/dotty/tools/dotc/repl/TestREPL.scala7
2 files changed, 35 insertions, 2 deletions
diff --git a/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala b/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
index 930ec117a..81ac77761 100644
--- a/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
+++ b/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
@@ -488,4 +488,34 @@ class DocstringTests extends DocstringTest {
checkDocString(c.rawComment.map(_.raw), "/** Class1 */")
}
}
+
+ @Test def nestedComment = {
+ val source =
+ """
+ |trait T {
+ | /** Cheeky comment */
+ |}
+ |class C
+ """.stripMargin
+
+ import dotty.tools.dotc.ast.untpd._
+ checkFrontend(source) {
+ case p @ PackageDef(_, Seq(_, c: TypeDef)) =>
+ assert(c.rawComment == None, s"class C is not supposed to have a docstring (${c.rawComment.get}) in:$source")
+ }
+ }
+
+ @Test def eofComment = {
+ val source =
+ """
+ |class C
+ |/** Cheeky comment */
+ """.stripMargin
+
+ import dotty.tools.dotc.ast.untpd._
+ checkFrontend(source) {
+ case p @ PackageDef(_, Seq(c: TypeDef)) =>
+ assert(c.rawComment == None, s"class C is not supposed to have a docstring (${c.rawComment.get}) in:$source")
+ }
+ }
} /* End class */
diff --git a/compiler/test/dotty/tools/dotc/repl/TestREPL.scala b/compiler/test/dotty/tools/dotc/repl/TestREPL.scala
index 131a88ab1..c5557b86e 100644
--- a/compiler/test/dotty/tools/dotc/repl/TestREPL.scala
+++ b/compiler/test/dotty/tools/dotc/repl/TestREPL.scala
@@ -4,7 +4,7 @@ package repl
import core.Contexts.Context
import collection.mutable
-import java.io.StringWriter
+import java.io.{StringWriter, PrintStream}
import dotty.tools.io.{ PlainFile, Directory }
import org.junit.Test
@@ -58,8 +58,11 @@ class TestREPL(script: String) extends REPL {
val printed = out.toString
val transcript = printed.drop(printed.indexOf(config.prompt))
if (transcript.toString.lines.toList != script.lines.toList) {
- println("input differs from transcript:")
+ println("input differs from transcript (copy is repl.transcript):")
println(transcript)
+ val s = new PrintStream("repl.transcript")
+ s.print(transcript)
+ s.close()
assert(false)
}
}