-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save original literal in ThematicBreak on parsing
Fixes #295.
- Loading branch information
Showing
3 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
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
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
29 changes: 29 additions & 0 deletions
29
commonmark/src/test/java/org/commonmark/test/ThematicBreakParserTest.java
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,29 @@ | ||
package org.commonmark.test; | ||
|
||
import org.commonmark.node.ThematicBreak; | ||
import org.commonmark.parser.Parser; | ||
import org.commonmark.renderer.html.HtmlRenderer; | ||
import org.commonmark.testutil.RenderingTestCase; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
public class ThematicBreakParserTest { | ||
|
||
private static final Parser PARSER = Parser.builder().build(); | ||
|
||
@Test | ||
public void testLiteral() { | ||
assertLiteral("***", "***"); | ||
assertLiteral("-- -", "-- -"); | ||
assertLiteral(" __ __ __ ", " __ __ __ "); | ||
assertLiteral("***", "> ***"); | ||
} | ||
|
||
private static void assertLiteral(String expected, String input) { | ||
var tb = Nodes.find(PARSER.parse(input), ThematicBreak.class); | ||
assertNotNull(tb); | ||
assertEquals(expected, tb.getLiteral()); | ||
} | ||
} |