aboutsummaryrefslogtreecommitdiff
path: root/compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala')
-rw-r--r--compiler/test/dotty/tools/dotc/parsing/DocstringTests.scala30
1 files changed, 30 insertions, 0 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 */