generated from rnentjes/kotlin-server-web-empty
Update project version to 1.0.3, fix string comparison logic in test function, and add a new test for link parsing.
This commit is contained in:
@@ -115,7 +115,7 @@ private val states = listOf(
|
||||
)
|
||||
|
||||
private fun String.test(index: Int, value: String): Boolean {
|
||||
return this.length > index + value.length && this.substring(index, index + value.length) == value
|
||||
return this.length >= index + value.length && this.substring(index, index + value.length) == value
|
||||
}
|
||||
|
||||
fun parseParagraph(text: String): MarkdownPart.Paragraph {
|
||||
|
||||
@@ -18,4 +18,16 @@ class TestParagraph {
|
||||
assertTrue(result.parts[1] is MarkdownPart.ParagraphPart.Bold)
|
||||
assertTrue(result.parts[2] is MarkdownPart.ParagraphPart.Text)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testLink() {
|
||||
val input = "[Samsung G8 G80SD](Samsung Odyssey G8 G80SD - OLED-monitor)"
|
||||
|
||||
val result = parseParagraph(input)
|
||||
|
||||
assertEquals(1, result.parts.size)
|
||||
|
||||
assertTrue(result.parts[0] is MarkdownPart.ParagraphPart.Link)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user