-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(Issue285Test.kt): test parse multiline html comment
- Loading branch information
1 parent
b755fdf
commit 2825387
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
processor-commonmark/src/test/kotlin/org/bsc/makdown/commonmark/Issue285Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.bsc.makdown.commonmark | ||
|
||
import org.bsc.confluence.model.Site | ||
import org.bsc.markdown.commonmark.CommonmarkConfluenceWikiVisitor.parseHTMLComment | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
import java.nio.file.Paths | ||
|
||
class Issue285Test { | ||
|
||
var site = Site().apply { | ||
basedir = Paths.get(System.getProperty("user.dir")) | ||
} | ||
|
||
@Test | ||
fun `parse excerpt macros`() { | ||
|
||
val excerptMacro = """ | ||
<!-- {excerpt:title=MyExcerpt} | ||
This is the content that I want to use as my excerpt. | ||
{excerpt} --> | ||
""".trimIndent() | ||
|
||
val multiLineMatcher = parseHTMLComment(excerptMacro) | ||
|
||
assertTrue( multiLineMatcher.matches() ) | ||
assertEquals( 2, multiLineMatcher.groupCount() ) | ||
assertEquals( """ | ||
{excerpt:title=MyExcerpt} | ||
This is the content that I want to use as my excerpt. | ||
{excerpt} | ||
""".trimIndent(), multiLineMatcher.group(2).trimEnd() ) | ||
|
||
} | ||
|
||
} |