aboutsummaryrefslogtreecommitdiff
path: root/doc-tool/test/CommentCleanerTest.scala
diff options
context:
space:
mode:
Diffstat (limited to 'doc-tool/test/CommentCleanerTest.scala')
-rw-r--r--doc-tool/test/CommentCleanerTest.scala83
1 files changed, 83 insertions, 0 deletions
diff --git a/doc-tool/test/CommentCleanerTest.scala b/doc-tool/test/CommentCleanerTest.scala
new file mode 100644
index 000000000..5cf5614c4
--- /dev/null
+++ b/doc-tool/test/CommentCleanerTest.scala
@@ -0,0 +1,83 @@
+package dotty.tools
+package dottydoc
+
+import org.junit.Test
+import org.junit.Assert._
+
+import model.comment.CommentCleaner
+
+class CommentCleanerTest extends CommentCleaner {
+ @Test def simpleOneliner = {
+ assertEquals(List("lol"), clean("/** lol */"))
+ }
+
+ @Test def multiline = {
+ val docstring = clean {
+ """|/** First
+ | * Second
+ | */
+ |""".stripMargin
+ }
+
+ assertEquals(List("First", "Second", ""), docstring)
+ }
+
+ @Test def multilineBad = {
+ val docstring = clean {
+ """|/** First
+ | * Second
+ | */
+ |""".stripMargin
+ }
+
+ assertEquals(List("First", " Second", ""), docstring)
+ }
+
+ @Test def multilineWorse = {
+ val docstring = clean {
+ """|/** First
+ | * Second
+ | * Third
+ | */
+ |""".stripMargin
+ }
+
+ assertEquals(List("First", " Second", "Third", ""), docstring)
+ }
+
+ @Test def multilineFirstNoSpace = {
+ val docstring = clean {
+ """|/**First
+ | * Second
+ | * Third
+ | */
+ |""".stripMargin
+ }
+
+ assertEquals(List("First", " Second", "Third", ""), docstring)
+ }
+
+ @Test def multilineFirstTwoSpaces = {
+ val docstring = clean {
+ """|/** First
+ | * Second
+ | * Third
+ | */
+ |""".stripMargin
+ }
+
+ assertEquals(List("First", " Second", "Third", ""), docstring)
+ }
+
+ @Test def multilineFirstThreeSpaces = {
+ val docstring = clean {
+ """|/** First
+ | * Second
+ | * Third
+ | */
+ |""".stripMargin
+ }
+
+ assertEquals(List(" First", " Second", "Third", ""), docstring)
+ }
+}