1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
import scala.tools.nsc.doc.html.Page
import scala.tools.nsc.doc.model._
import scala.tools.partest.ScaladocModelTest
object Test extends ScaladocModelTest {
override def code = """
/** This comment contains ^superscript^ */
class Foo {
/** This comment contains ,,subscript,, */
def bar = ???
/** This comment contains a link [[https://scala.epfl.ch/]] */
def baz = ???
/** This comment contains an <strong>html tag</strong> */
def qux = ???
/** This comment contains a<br> single html tag */
def quux = ???
/** This comment contains nested <strong>html<br> tags</strong> */
def quuz = ???
/** This comment contains a [[corge ,,link with a subscript title,,]] */
def corge = ???
}
"""
def scaladocSettings = ""
def testModel(root: Package) = {
import scala.tools.nsc.doc.base.comment._
import access._
val foo = root._class("Foo")
val fooStr = Page.inlineToStr(foo.comment.get.short)
assert(fooStr == "This comment contains superscript", fooStr)
val barStr = Page.inlineToStr(foo._method("bar").comment.get.short)
assert(barStr == "This comment contains subscript", barStr)
val bazStr = Page.inlineToStr(foo._method("baz").comment.get.short)
assert(bazStr == "This comment contains a link https://scala.epfl.ch/", bazStr)
val quxStr = Page.inlineToStr(foo._method("qux").comment.get.short)
assert(quxStr == "This comment contains an html tag", quxStr)
val quuxStr = Page.inlineToStr(foo._method("quux").comment.get.short)
assert(quuxStr == "This comment contains a single html tag", quuxStr)
val quuzStr = Page.inlineToStr(foo._method("quuz").comment.get.short)
assert(quuzStr == "This comment contains nested html tags", quuzStr)
val corgeStr = Page.inlineToStr(foo._method("corge").comment.get.short)
assert(corgeStr == "This comment contains a link with a subscript title", corgeStr)
}
}
|