From bc594c81c6ce8c696dde2f7668132952e83b383a Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Thu, 5 May 2016 12:22:53 +0200 Subject: Add test for simple comment --- dottydoc/jvm/test/TestCommentParsing.scala | 18 ----------------- dottydoc/jvm/test/TestSimpleComments.scala | 29 +++++++++++++++++++++++++++ dottydoc/jvm/test/TestWhitelistedStdLib.scala | 17 ++++++++++++++++ 3 files changed, 46 insertions(+), 18 deletions(-) delete mode 100644 dottydoc/jvm/test/TestCommentParsing.scala create mode 100644 dottydoc/jvm/test/TestSimpleComments.scala create mode 100644 dottydoc/jvm/test/TestWhitelistedStdLib.scala (limited to 'dottydoc/jvm/test') diff --git a/dottydoc/jvm/test/TestCommentParsing.scala b/dottydoc/jvm/test/TestCommentParsing.scala deleted file mode 100644 index 12f60f6a6..000000000 --- a/dottydoc/jvm/test/TestCommentParsing.scala +++ /dev/null @@ -1,18 +0,0 @@ -package dotty.tools -package dottydoc - -import org.junit.Test -import org.junit.Assert._ - -class TestWhitelistedCollections extends DottyTest { - @Test def arrayHasDocumentation = - checkCompile(WhitelistedStandardLib.files) { doc => - val array = doc - .packages("scala") - .children - .find(_.path.mkString(".") == "scala.Array") - .get - - assert(array.comment.get.body.length > 0) - } -} diff --git a/dottydoc/jvm/test/TestSimpleComments.scala b/dottydoc/jvm/test/TestSimpleComments.scala new file mode 100644 index 000000000..48cdecec0 --- /dev/null +++ b/dottydoc/jvm/test/TestSimpleComments.scala @@ -0,0 +1,29 @@ +package dotty.tools +package dottydoc + +import org.junit.Test +import org.junit.Assert._ + +class TestSimpleComments extends DottyTest { + + @Test def simpleComment = { + val source = + """ + |package scala + | + |/** Hello, world! */ + |trait HelloWorld + """.stripMargin + + checkCompile(source) { doc => + val traitCmt = doc + .packages("scala") + .children.find(_.path.mkString(".") == "scala.HelloWorld") + .flatMap(_.comment.map(_.body)) + .get + + assertEquals(traitCmt, "

Hello, world!

") + } + } + +} diff --git a/dottydoc/jvm/test/TestWhitelistedStdLib.scala b/dottydoc/jvm/test/TestWhitelistedStdLib.scala new file mode 100644 index 000000000..763f41370 --- /dev/null +++ b/dottydoc/jvm/test/TestWhitelistedStdLib.scala @@ -0,0 +1,17 @@ +package dotty.tools +package dottydoc + +import org.junit.Test +import org.junit.Assert._ + +class TestWhitelistedCollections extends DottyTest { + @Test def arrayHasDocumentation = + checkCompile(WhitelistedStandardLib.files) { doc => + val array = doc + .packages("scala") + .children.find(_.path.mkString(".") == "scala.Array") + .get + + assert(array.comment.get.body.length > 0) + } +} -- cgit v1.2.3