aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/comments/directive.kt35
-rw-r--r--test/src/TestAPI.kt6
-rw-r--r--test/src/model/CommentTest.kt35
3 files changed, 76 insertions, 0 deletions
diff --git a/test/data/comments/directive.kt b/test/data/comments/directive.kt
new file mode 100644
index 00000000..9883b7bd
--- /dev/null
+++ b/test/data/comments/directive.kt
@@ -0,0 +1,35 @@
+/**
+ * Summary
+ *
+ * ${code example1}
+ * ${code example2}
+ * ${code X.example3}
+ * ${code X.Y.example4}
+ */
+val property = "test"
+
+fun example1(node: String) = if (true) {
+ println(property)
+}
+
+fun example2(node: String) {
+ if (true) {
+ println(property)
+ }
+}
+
+class X {
+ fun example3(node: String) {
+ if (true) {
+ println(property)
+ }
+ }
+
+ class Y {
+ fun example4(node: String) {
+ if (true) {
+ println(property)
+ }
+ }
+ }
+}
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index 901e78fc..7d0d3bdd 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -73,6 +73,12 @@ fun StringBuilder.appendNode(node: ContentNode): StringBuilder {
append(node.text)
}
is ContentEmphasis -> append("*").appendChildren(node).append("*")
+ is ContentBlockCode -> {
+ appendln("[code]")
+ appendChildren(node)
+ appendln()
+ appendln("[/code]")
+ }
is ContentNodeLink -> {
append("[")
appendChildren(node)
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt
index 2d87b928..63a957e7 100644
--- a/test/src/model/CommentTest.kt
+++ b/test/src/model/CommentTest.kt
@@ -142,4 +142,39 @@ line two""", toTestString())
}
}
}
+
+ Test fun directive() {
+ verifyModel("test/data/comments/directive.kt") { model ->
+ with(model.members.single().members.first()) {
+ assertEquals("Summary", content.summary.toTestString())
+ assertEquals(2, content.sections.count())
+ with (content.description) {
+ assertEquals("""[code]
+if (true) {
+ println(property)
+}
+[/code]
+
+[code]
+if (true) {
+ println(property)
+}
+[/code]
+
+[code]
+if (true) {
+ println(property)
+}
+[/code]
+
+[code]
+if (true) {
+ println(property)
+}
+[/code]
+""", toTestString())
+ }
+ }
+ }
+ }
}