From ebdf5dac81da51232c65fff688b56819f94e5b31 Mon Sep 17 00:00:00 2001 From: Sam Shih Date: Wed, 21 Oct 2020 13:06:15 -0700 Subject: [PATCH] Fix tests after adding Parser.State param --- .../discord/simpleast/core/ParserTest.java | 14 +++++------ .../simpleast/markdown/MarkdownRulesTest.kt | 25 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/simpleast-core/src/test/java/com/discord/simpleast/core/ParserTest.java b/simpleast-core/src/test/java/com/discord/simpleast/core/ParserTest.java index 028939d..8e028b7 100644 --- a/simpleast-core/src/test/java/com/discord/simpleast/core/ParserTest.java +++ b/simpleast-core/src/test/java/com/discord/simpleast/core/ParserTest.java @@ -23,7 +23,7 @@ public class ParserTest { - private Parser> parser; + private Parser, Object> parser; private TreeMatcher treeMatcher; @Before @@ -41,13 +41,13 @@ public void tearDown() { @Test public void testEmptyParse() throws Exception { - final List> ast = parser.parse(""); + final List> ast = parser.parse("", null); Assert.assertTrue(ast.isEmpty()); } @Test public void testParseFormattedText() throws Exception { - final List> ast = parser.parse("**bold**"); + final List> ast = parser.parse("**bold**", null); final StyleNode boldNode = StyleNode.Companion.createWithText("bold", Collections.singletonList((CharacterStyle) new StyleSpan(Typeface.BOLD))); @@ -57,7 +57,7 @@ public void testParseFormattedText() throws Exception { @Test public void testParseLeadingFormatting() throws Exception { - final List> ast = parser.parse("**bold** and not bold"); + final List> ast = parser.parse("**bold** and not bold", null); final StyleNode boldNode = StyleNode.Companion.createWithText("bold", Collections.singletonList((CharacterStyle) new StyleSpan(Typeface.BOLD))); final TextNode trailingText = new TextNode(" and not bold"); @@ -68,7 +68,7 @@ public void testParseLeadingFormatting() throws Exception { @Test public void testParseTrailingFormatting() throws Exception { - final List> ast = parser.parse("not bold **and bold**"); + final List> ast = parser.parse("not bold **and bold**", null); final TextNode leadingText = new TextNode("not bold "); final StyleNode boldNode = StyleNode.Companion.createWithText("and bold", Collections.singletonList((CharacterStyle) new StyleSpan(Typeface.BOLD))); @@ -80,7 +80,7 @@ public void testParseTrailingFormatting() throws Exception { @Test public void testNestedFormatting() throws Exception { // final List ast = parser.parse("*** test1 ** test2 * test3 * test4 ** test5 ***"); - final List> ast = parser.parse("**bold *and italics* and more bold**"); + final List> ast = parser.parse("**bold *and italics* and more bold**", null); // final List ast = parser.parse("______" + // "t" // + "______"); @@ -97,7 +97,7 @@ public void testNestedFormatting() throws Exception { @Test public void testNewlineRule() { - final List> ast = parser.parse("Some text\n\n\n \n\n\nnewline above"); + final List> ast = parser.parse("Some text\n\n\n \n\n\nnewline above", null); final List model = Arrays.asList( new TextNode<>("Some text"), diff --git a/simpleast-core/src/test/java/com/discord/simpleast/markdown/MarkdownRulesTest.kt b/simpleast-core/src/test/java/com/discord/simpleast/markdown/MarkdownRulesTest.kt index 05411c4..ca27449 100644 --- a/simpleast-core/src/test/java/com/discord/simpleast/markdown/MarkdownRulesTest.kt +++ b/simpleast-core/src/test/java/com/discord/simpleast/markdown/MarkdownRulesTest.kt @@ -19,7 +19,7 @@ import org.junit.Test class MarkdownRulesTest { - private lateinit var parser: Parser> + private lateinit var parser: Parser, Any?> private lateinit var treeMatcher: TreeMatcher @Before @@ -48,7 +48,7 @@ class MarkdownRulesTest { * item 2 End - """.trimIndent()) + """.trimIndent(), Unit) val listItemNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -68,7 +68,7 @@ class MarkdownRulesTest { List of stuff -* item 1 =* item 2 - """.trimIndent()) + """.trimIndent(), Unit) val listItemNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -85,7 +85,8 @@ class MarkdownRulesTest { val ast = parser.parse(""" List of stuff * item 1 - * item 2""".trimIndent()) + * item 2 + """.trimIndent(), Unit) val listItemNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -107,7 +108,7 @@ class MarkdownRulesTest { some content ## Header 2 ### Header 3 - """.trimIndent()) + """.trimIndent(), Unit) val styledNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -130,7 +131,7 @@ class MarkdownRulesTest { # Header 2 - """.trimIndent()) + """.trimIndent(), Unit) val expected = listOf>( TextNode("Title"), @@ -153,7 +154,7 @@ class MarkdownRulesTest { some content -## Header 2 other content for listing # of items - """.trimIndent()) + """.trimIndent(), Unit) val styledNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -170,7 +171,7 @@ class MarkdownRulesTest { __Alt__ Header ====== some content - """.trimIndent()) + """.trimIndent(), Unit) val styledNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -192,14 +193,14 @@ class MarkdownRulesTest { @Test fun headerAltAfterParagraph() { - val ast = parser.parse(""" + val ast = parser.parse(""" Some introduction text. Alt Header ======= some content - """.trimIndent()) + """.trimIndent(), Unit) val expected = listOf>( TextNode("Some introduction text"), @@ -221,7 +222,7 @@ class MarkdownRulesTest { Should Succeed. Alt Header ====== some content - """.trimIndent()) + """.trimIndent(), Unit) val styledNodes = ArrayList>() ASTUtils.traversePreOrder(ast) { @@ -244,7 +245,7 @@ class MarkdownRulesTest { *Alt*. Header {strike unknown} ====== some content - """.trimIndent()) + """.trimIndent(), Unit) val styledNodes = ArrayList>() ASTUtils.traversePreOrder(ast) {