diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2017-01-24 18:26:15 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2017-01-31 14:35:42 +0100 |
commit | 483ac5340db262adb5efcf747a97dc9f25bc0208 (patch) | |
tree | d18b2dd3b610564768ffd809b6f77023fe24ae7a /doc-tool/test | |
parent | 866e364dde76aa5df42548bf72d2f5c4d200535b (diff) | |
download | dotty-483ac5340db262adb5efcf747a97dc9f25bc0208.tar.gz dotty-483ac5340db262adb5efcf747a97dc9f25bc0208.tar.bz2 dotty-483ac5340db262adb5efcf747a97dc9f25bc0208.zip |
Fix javadoc indentation style parsing
Diffstat (limited to 'doc-tool/test')
-rw-r--r-- | doc-tool/test/CommentCleanerTest.scala | 83 |
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) + } +} |