aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Model/DocumentationContent.kt2
-rw-r--r--test/data/comments/sectionWithBracedLabel.kt5
-rw-r--r--test/src/model/CommentTest.kt13
3 files changed, 19 insertions, 1 deletions
diff --git a/src/Model/DocumentationContent.kt b/src/Model/DocumentationContent.kt
index ee91aed3..d3826434 100644
--- a/src/Model/DocumentationContent.kt
+++ b/src/Model/DocumentationContent.kt
@@ -62,7 +62,7 @@ fun String.parseLabel(index: Int): Pair<String, Int> {
}
c == '{' -> {
val end = indexOf('}', index + 1)
- return substring(index, end) to index + 2
+ return substring(index + 1, end) to end + 2
}
}
return "" to -1
diff --git a/test/data/comments/sectionWithBracedLabel.kt b/test/data/comments/sectionWithBracedLabel.kt
new file mode 100644
index 00000000..306917ec
--- /dev/null
+++ b/test/data/comments/sectionWithBracedLabel.kt
@@ -0,0 +1,5 @@
+/**
+ * Summary
+ * ${this.label.is.really.long} section one
+ */
+val property = "test" \ No newline at end of file
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt
index 6c835f8d..b30cfbf4 100644
--- a/test/src/model/CommentTest.kt
+++ b/test/src/model/CommentTest.kt
@@ -157,4 +157,17 @@ line two""", text)
}
}
}
+
+ Test fun sectionWithBracedLabel() {
+ verifyModel("test/data/comments/sectionWithBracedLabel.kt") { model ->
+ with(model.nodes.single().members.single()) {
+ assertEquals("Summary", doc.summary)
+ assertEquals(1, doc.sections.count())
+ with (doc.sections.elementAt(0)) {
+ assertEquals("this.label.is.really.long", label)
+ assertEquals("section one", text)
+ }
+ }
+ }
+ }
}