From 414a8763f2f7e7d8b8bd2df6e90f1e355d625b6a Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Mon, 17 Dec 2018 16:18:20 +0300 Subject: [PATCH] Redefine test format --- .../java/ru/noties/markwon/test/TestSpan.java | 1 + .../noties/markwon/test/TestSpanMatcher.java | 8 +- .../ru/noties/markwon/test/TestSpanSpan.java | 2 - .../ru/noties/markwon/test/TestSpanTest.java | 70 +++++++++++++++ markwon-test-util/build.gradle | 13 +++ .../java/ru/noties/markwon/test/TestUtil.java | 32 +++++++ markwon/build.gradle | 8 +- .../java/ru/noties/markwon/core/CoreTest.java | 60 +++++++++++++ .../noties/markwon/core/suite/.editorconfig | 4 + .../markwon/core/suite/BaseSuiteTest.java | 44 ++++++++++ .../noties/markwon/core/suite/BoldItalic.java | 33 +++++++ .../noties/markwon/core/suite/CodeBlocks.java | 51 +++++++++++ .../markwon/core/suite/DeeplyNested.java | 44 ++++++++++ .../ru/noties/markwon/core/suite/First.java | 46 ++++++++++ .../markwon/core/suite/TestFactory.java | 88 +++++++++++++++++++ .../visitor/BlockQuoteNodeVisitorTest.java | 18 ++++ .../src/test/resources/tests/bold-italic.md | 1 + .../src/test/resources/tests/bold-italic.yaml | 5 -- .../src/test/resources/tests/code-blocks.md | 9 ++ .../src/test/resources/tests/code-blocks.yaml | 17 ---- .../src/test/resources/tests/deeply-nested.md | 1 + .../test/resources/tests/deeply-nested.yaml | 12 --- markwon/src/test/resources/tests/first.md | 2 + markwon/src/test/resources/tests/first.yaml | 23 ----- settings.gradle | 1 + 25 files changed, 530 insertions(+), 63 deletions(-) create mode 100644 markwon-test-span/src/test/java/ru/noties/markwon/test/TestSpanTest.java create mode 100644 markwon-test-util/build.gradle create mode 100644 markwon-test-util/src/main/java/ru/noties/markwon/test/TestUtil.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/CoreTest.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/.editorconfig create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/BaseSuiteTest.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/BoldItalic.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/CodeBlocks.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/DeeplyNested.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/First.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/suite/TestFactory.java create mode 100644 markwon/src/test/java/ru/noties/markwon/core/visitor/BlockQuoteNodeVisitorTest.java create mode 100644 markwon/src/test/resources/tests/bold-italic.md delete mode 100644 markwon/src/test/resources/tests/bold-italic.yaml create mode 100644 markwon/src/test/resources/tests/code-blocks.md delete mode 100644 markwon/src/test/resources/tests/code-blocks.yaml create mode 100644 markwon/src/test/resources/tests/deeply-nested.md delete mode 100644 markwon/src/test/resources/tests/deeply-nested.yaml create mode 100644 markwon/src/test/resources/tests/first.md delete mode 100644 markwon/src/test/resources/tests/first.yaml diff --git a/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpan.java b/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpan.java index bc2bd524..f979d633 100644 --- a/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpan.java +++ b/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpan.java @@ -105,6 +105,7 @@ public abstract class TestSpan { public abstract int length(); } + // important: children should not be included in equals... public static abstract class Span extends TestSpan { @NonNull diff --git a/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanMatcher.java b/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanMatcher.java index e9bf190b..1eb2a1bc 100644 --- a/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanMatcher.java +++ b/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanMatcher.java @@ -72,16 +72,18 @@ public abstract class TestSpanMatcher { @NonNull final Spanned spanned, final int start, final int end, - @NonNull TestSpan.Span expected) { + @NonNull final TestSpan.Span expected) { // when queried multiple spans can be returned (for example if one span // wraps another one. so [0 1 [2 3] 4 5] where [] represents start/end of // a span of same type, when queried for spans at 2-3 position, both will be returned - final TestSpan.Span actual = Ix.fromArray(spanned.getSpans(start, end, expected.getClass())) + final TestSpan.Span actual = Ix.fromArray(spanned.getSpans(start, end, Object.class)) + .cast(TestSpan.Span.class) .filter(new IxPredicate() { @Override public boolean test(TestSpan.Span span) { - return start == spanned.getSpanStart(span) + return expected.name().equals(span.name()) + && start == spanned.getSpanStart(span) && end == spanned.getSpanEnd(span); } }) diff --git a/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanSpan.java b/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanSpan.java index 5dc60acd..d9669cb2 100644 --- a/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanSpan.java +++ b/markwon-test-span/src/main/java/ru/noties/markwon/test/TestSpanSpan.java @@ -46,14 +46,12 @@ class TestSpanSpan extends TestSpan.Span { TestSpanSpan that = (TestSpanSpan) o; if (!name.equals(that.name)) return false; - if (!children.equals(that.children)) return false; return arguments.equals(that.arguments); } @Override public int hashCode() { int result = name.hashCode(); - result = 31 * result + children.hashCode(); result = 31 * result + arguments.hashCode(); return result; } diff --git a/markwon-test-span/src/test/java/ru/noties/markwon/test/TestSpanTest.java b/markwon-test-span/src/test/java/ru/noties/markwon/test/TestSpanTest.java new file mode 100644 index 00000000..5e178409 --- /dev/null +++ b/markwon-test-span/src/test/java/ru/noties/markwon/test/TestSpanTest.java @@ -0,0 +1,70 @@ +package ru.noties.markwon.test; + +import org.junit.Test; + +import java.util.Map; + +import ru.noties.markwon.test.TestSpan.Document; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static ru.noties.markwon.test.TestSpan.args; +import static ru.noties.markwon.test.TestSpan.document; +import static ru.noties.markwon.test.TestSpan.span; +import static ru.noties.markwon.test.TestSpan.text; + +public class TestSpanTest { + + @Test + public void args_not_event_throws() { + try { + args("key"); + fail(); + } catch (IllegalStateException e) { + assertTrue(e.getMessage(), e.getMessage().contains("Supplied key-values array must contain ")); + } + } + + @Test + public void args_key_not_string_throws() { + try { + args("key", 1, 2, 3); + fail(); + } catch (ClassCastException e) { + assertTrue(true); + } + } + + @Test + public void args_correct() { + + final Map args = args("key1", true, "key2", 4); + + assertEquals(2, args.size()); + assertEquals(true, args.get("key1")); + assertEquals(4, args.get("key2")); + } + + @Test + public void empty_document() { + final Document document = document(); + assertEquals(0, document.children().size()); + assertEquals("", document.wholeText()); + } + + @Test + public void document_single_text_child() { + final Document document = document(text("Text")); + assertEquals(1, document.children().size()); + assertEquals("Text", document.wholeText()); + } + + @Test + public void document_single_span_child() { + final Document document = document(span("span", text("TextInSpan"))); + assertEquals(1, document.children().size()); + assertTrue(document.children().get(0) instanceof TestSpan.Span); + assertEquals("TextInSpan", document.wholeText()); + } +} diff --git a/markwon-test-util/build.gradle b/markwon-test-util/build.gradle new file mode 100644 index 00000000..3909ab27 --- /dev/null +++ b/markwon-test-util/build.gradle @@ -0,0 +1,13 @@ +apply plugin: 'java-library' + +sourceCompatibility = 1.7 +targetCompatibility = 1.7 + +dependencies { + + api deps['support-annotations'] + + deps['test'].with { + implementation it['commons-io'] + } +} \ No newline at end of file diff --git a/markwon-test-util/src/main/java/ru/noties/markwon/test/TestUtil.java b/markwon-test-util/src/main/java/ru/noties/markwon/test/TestUtil.java new file mode 100644 index 00000000..2ce00e1f --- /dev/null +++ b/markwon-test-util/src/main/java/ru/noties/markwon/test/TestUtil.java @@ -0,0 +1,32 @@ +package ru.noties.markwon.test; + +import android.support.annotation.NonNull; + +import org.apache.commons.io.IOUtils; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +public abstract class TestUtil { + + @NonNull + public static String read(@NonNull String path) { + try { + return IOUtils.resourceToString(path, StandardCharsets.UTF_8); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + @NonNull + public static String read(@NonNull Object who, @NonNull String path) { + try { + return IOUtils.resourceToString(path, StandardCharsets.UTF_8, who.getClass().getClassLoader()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + private TestUtil() { + } +} diff --git a/markwon/build.gradle b/markwon/build.gradle index e1d9db87..604519a2 100644 --- a/markwon/build.gradle +++ b/markwon/build.gradle @@ -21,14 +21,20 @@ dependencies { } deps['test'].with { + + testImplementation project(':markwon-test-span') + testImplementation project(':markwon-test-util') + testImplementation it['junit'] testImplementation it['robolectric'] + testImplementation it['mockito'] + + // to remove after migration testImplementation it['ix-java'] testImplementation it['jackson-yaml'] testImplementation it['jackson-databind'] testImplementation it['gson'] testImplementation it['commons-io'] - testImplementation it['mockito'] } } diff --git a/markwon/src/test/java/ru/noties/markwon/core/CoreTest.java b/markwon/src/test/java/ru/noties/markwon/core/CoreTest.java new file mode 100644 index 00000000..7fc110ff --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/CoreTest.java @@ -0,0 +1,60 @@ +package ru.noties.markwon.core; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.text.Spanned; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import ru.noties.markwon.AbstractMarkwonPlugin; +import ru.noties.markwon.Markwon; +import ru.noties.markwon.MarkwonConfiguration; +import ru.noties.markwon.SpannableFactoryDef; +import ru.noties.markwon.test.TestSpan; +import ru.noties.markwon.test.TestSpanMatcher; + +import static ru.noties.markwon.test.TestSpan.document; +import static ru.noties.markwon.test.TestSpan.span; +import static ru.noties.markwon.test.TestSpan.text; + +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class CoreTest { + + @Test + public void bold_italic() { + + final String input = "**_bold italic_**"; + final TestSpan.Document document = document( + span("bold", + span("italic", text("bold italic")))); + + final Spanned spanned = (Spanned) Markwon.builder(RuntimeEnvironment.application) + .use(CorePlugin.create()) + .use(new AbstractMarkwonPlugin() { + @Override + public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) { + builder.factory(new SpannableFactoryDef() { + + @Override + public Object strongEmphasis() { + return span("bold"); + } + + @Override + public Object emphasis() { + return span("italic"); + } + }); + } + }) + .build() + .toMarkdown(input); + + TestSpanMatcher.matches(spanned, document); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/.editorconfig b/markwon/src/test/java/ru/noties/markwon/core/suite/.editorconfig new file mode 100644 index 00000000..be598039 --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/.editorconfig @@ -0,0 +1,4 @@ +# 2 space indentation +[*.java] +indent_style = space +indent_size = 2 \ No newline at end of file diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/BaseSuiteTest.java b/markwon/src/test/java/ru/noties/markwon/core/suite/BaseSuiteTest.java new file mode 100644 index 00000000..6fec8d8d --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/BaseSuiteTest.java @@ -0,0 +1,44 @@ +package ru.noties.markwon.core.suite; + +import android.support.annotation.NonNull; +import android.text.Spanned; + +import org.robolectric.RuntimeEnvironment; + +import ru.noties.markwon.AbstractMarkwonPlugin; +import ru.noties.markwon.Markwon; +import ru.noties.markwon.MarkwonConfiguration; +import ru.noties.markwon.core.CorePlugin; +import ru.noties.markwon.test.TestSpan; +import ru.noties.markwon.test.TestSpanMatcher; +import ru.noties.markwon.test.TestUtil; + +abstract class BaseSuiteTest { + + void matches(@NonNull String input, @NonNull TestSpan.Document document) { + final Spanned spanned = (Spanned) markwon().toMarkdown(input); + TestSpanMatcher.matches(spanned, document); + } + + void matchInput(@NonNull String name, @NonNull TestSpan.Document document) { + matches(read(name), document); + } + + @NonNull + String read(@NonNull String name) { + return TestUtil.read(this, "tests/" + name); + } + + @NonNull + Markwon markwon() { + return Markwon.builder(RuntimeEnvironment.application) + .use(CorePlugin.create()) + .use(new AbstractMarkwonPlugin() { + @Override + public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) { + builder.factory(new TestFactory()); + } + }) + .build(); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/BoldItalic.java b/markwon/src/test/java/ru/noties/markwon/core/suite/BoldItalic.java new file mode 100644 index 00000000..c0ad4bd1 --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/BoldItalic.java @@ -0,0 +1,33 @@ +package ru.noties.markwon.core.suite; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import ru.noties.markwon.test.TestSpan; + +import static ru.noties.markwon.core.suite.TestFactory.BOLD; +import static ru.noties.markwon.core.suite.TestFactory.ITALIC; +import static ru.noties.markwon.test.TestSpan.document; +import static ru.noties.markwon.test.TestSpan.span; +import static ru.noties.markwon.test.TestSpan.text; + +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class BoldItalic extends BaseSuiteTest { + + /* + **_bold italic_** + */ + + @Test + public void test() { + + final TestSpan.Document document = document( + span(BOLD, + span(ITALIC, text("bold italic")))); + + matchInput("bold-italic.md", document); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/CodeBlocks.java b/markwon/src/test/java/ru/noties/markwon/core/suite/CodeBlocks.java new file mode 100644 index 00000000..6427f0ec --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/CodeBlocks.java @@ -0,0 +1,51 @@ +package ru.noties.markwon.core.suite; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import ru.noties.markwon.test.TestSpan; + +import static ru.noties.markwon.core.suite.TestFactory.CODE; +import static ru.noties.markwon.test.TestSpan.args; +import static ru.noties.markwon.test.TestSpan.document; +import static ru.noties.markwon.test.TestSpan.span; +import static ru.noties.markwon.test.TestSpan.text; + +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class CodeBlocks extends BaseSuiteTest { + + /* + ```java + final String s = null; + ``` + ```html + + ``` + ``` + nothing here + ``` + */ + + @Test + public void test() { + + final TestSpan.Document document = document( + span(CODE, + args("multiline", true), + text("\u00a0\nfinal String s = null;\n\u00a0")), + text("\n\n"), + span(CODE, + args("multiline", true), + text("\u00a0\n\n\u00a0")), + text("\n\n"), + span(CODE, + args("multiline", true), + text("\u00a0\nnothing here\n\u00a0")) + ); + + matchInput("code-blocks.md", document); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/DeeplyNested.java b/markwon/src/test/java/ru/noties/markwon/core/suite/DeeplyNested.java new file mode 100644 index 00000000..16e5b2e6 --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/DeeplyNested.java @@ -0,0 +1,44 @@ +package ru.noties.markwon.core.suite; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import ru.noties.markwon.test.TestSpan.Document; + +import static ru.noties.markwon.core.suite.TestFactory.BOLD; +import static ru.noties.markwon.core.suite.TestFactory.CODE; +import static ru.noties.markwon.core.suite.TestFactory.ITALIC; +import static ru.noties.markwon.test.TestSpan.args; +import static ru.noties.markwon.test.TestSpan.document; +import static ru.noties.markwon.test.TestSpan.span; +import static ru.noties.markwon.test.TestSpan.text; + +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class DeeplyNested extends BaseSuiteTest { + + /* + **bold *bold italic `bold italic code` bold italic* bold** normal + */ + + @Test + public void test() { + + final Document document = document( + span(BOLD, + text("bold "), + span(ITALIC, + text("bold italic "), + span(CODE, + args("multiline", false), + text("\u00a0bold italic code\u00a0")), + text(" bold italic")), + text(" bold")), + text(" normal") + ); + + matchInput("deeply-nested.md", document); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/First.java b/markwon/src/test/java/ru/noties/markwon/core/suite/First.java new file mode 100644 index 00000000..9aaf05ed --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/First.java @@ -0,0 +1,46 @@ +package ru.noties.markwon.core.suite; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import ru.noties.markwon.test.TestSpan.Document; + +import static ru.noties.markwon.core.suite.TestFactory.BOLD; +import static ru.noties.markwon.core.suite.TestFactory.ITALIC; +import static ru.noties.markwon.core.suite.TestFactory.LINK; +import static ru.noties.markwon.test.TestSpan.args; +import static ru.noties.markwon.test.TestSpan.document; +import static ru.noties.markwon.test.TestSpan.span; +import static ru.noties.markwon.test.TestSpan.text; + +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class First extends BaseSuiteTest { + + /* + Here is some [link](https://my.href) + **bold _bold italic_ bold** normal + */ + + @Test + public void test() { + + final Document document = document( + text("Here is some "), + span(LINK, + args("href", "https://my.href"), + text("link")), + text(" "), + span(BOLD, + text("bold "), + span(ITALIC, + text("bold italic")), + text(" bold")), + text(" normal") + ); + + matchInput("first.md", document); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/suite/TestFactory.java b/markwon/src/test/java/ru/noties/markwon/core/suite/TestFactory.java new file mode 100644 index 00000000..222e2092 --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/suite/TestFactory.java @@ -0,0 +1,88 @@ +package ru.noties.markwon.core.suite; + +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; + +import ru.noties.markwon.SpannableFactory; +import ru.noties.markwon.core.MarkwonTheme; +import ru.noties.markwon.core.spans.LinkSpan; +import ru.noties.markwon.image.AsyncDrawableLoader; +import ru.noties.markwon.image.ImageSize; +import ru.noties.markwon.image.ImageSizeResolver; + +import static ru.noties.markwon.test.TestSpan.args; +import static ru.noties.markwon.test.TestSpan.span; + +class TestFactory implements SpannableFactory { + + static final String BOLD = "bold"; + static final String ITALIC = "italic"; + static final String CODE = "code"; + static final String LINK = "link"; + + @Nullable + @Override + public Object strongEmphasis() { + return span(BOLD); + } + + @Nullable + @Override + public Object emphasis() { + return span(ITALIC); + } + + @Nullable + @Override + public Object blockQuote(@NonNull MarkwonTheme theme) { + return null; + } + + @Nullable + @Override + public Object code(@NonNull MarkwonTheme theme, boolean multiline) { + return span(CODE, args("multiline", multiline)); + } + + @Nullable + @Override + public Object orderedListItem(@NonNull MarkwonTheme theme, int startNumber) { + return null; + } + + @Nullable + @Override + public Object bulletListItem(@NonNull MarkwonTheme theme, int level) { + return null; + } + + @Nullable + @Override + public Object thematicBreak(@NonNull MarkwonTheme theme) { + return null; + } + + @Nullable + @Override + public Object heading(@NonNull MarkwonTheme theme, int level) { + return null; + } + + @Nullable + @Override + public Object paragraph(boolean inTightList) { + return null; + } + + @Nullable + @Override + public Object image(@NonNull MarkwonTheme theme, @NonNull String destination, @NonNull AsyncDrawableLoader loader, @NonNull ImageSizeResolver imageSizeResolver, @Nullable ImageSize imageSize, boolean replacementTextIsLink) { + return null; + } + + @Nullable + @Override + public Object link(@NonNull MarkwonTheme theme, @NonNull String destination, @NonNull LinkSpan.Resolver resolver) { + return span(LINK, args("href", destination)); + } +} diff --git a/markwon/src/test/java/ru/noties/markwon/core/visitor/BlockQuoteNodeVisitorTest.java b/markwon/src/test/java/ru/noties/markwon/core/visitor/BlockQuoteNodeVisitorTest.java new file mode 100644 index 00000000..f83173ce --- /dev/null +++ b/markwon/src/test/java/ru/noties/markwon/core/visitor/BlockQuoteNodeVisitorTest.java @@ -0,0 +1,18 @@ +package ru.noties.markwon.core.visitor; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.annotation.Config; + +import static org.junit.Assert.*; + +@RunWith(RobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class BlockQuoteNodeVisitorTest { + + @Test + public void test() { + fail(); + } +} \ No newline at end of file diff --git a/markwon/src/test/resources/tests/bold-italic.md b/markwon/src/test/resources/tests/bold-italic.md new file mode 100644 index 00000000..757cfe8c --- /dev/null +++ b/markwon/src/test/resources/tests/bold-italic.md @@ -0,0 +1 @@ +**_bold italic_** \ No newline at end of file diff --git a/markwon/src/test/resources/tests/bold-italic.yaml b/markwon/src/test/resources/tests/bold-italic.yaml deleted file mode 100644 index d7d24682..00000000 --- a/markwon/src/test/resources/tests/bold-italic.yaml +++ /dev/null @@ -1,5 +0,0 @@ -input: "**_bold italic_**" - -output: - - b: - - i: "bold italic" \ No newline at end of file diff --git a/markwon/src/test/resources/tests/code-blocks.md b/markwon/src/test/resources/tests/code-blocks.md new file mode 100644 index 00000000..3b24ed05 --- /dev/null +++ b/markwon/src/test/resources/tests/code-blocks.md @@ -0,0 +1,9 @@ +```java +final String s = null; +``` +```html + +``` +``` +nothing here +``` \ No newline at end of file diff --git a/markwon/src/test/resources/tests/code-blocks.yaml b/markwon/src/test/resources/tests/code-blocks.yaml deleted file mode 100644 index 53b9bd50..00000000 --- a/markwon/src/test/resources/tests/code-blocks.yaml +++ /dev/null @@ -1,17 +0,0 @@ -input: |- - ```java - final String s = null; - ``` - ```html - - ``` - ``` - nothing here - ``` - -output: - - code-block: "final String s = null;" - - "\n\n" - - code-block: "" - - "\n\n" - - code-block: "nothing here" \ No newline at end of file diff --git a/markwon/src/test/resources/tests/deeply-nested.md b/markwon/src/test/resources/tests/deeply-nested.md new file mode 100644 index 00000000..3f8f18ab --- /dev/null +++ b/markwon/src/test/resources/tests/deeply-nested.md @@ -0,0 +1 @@ +**bold *bold italic `bold italic code` bold italic* bold** normal \ No newline at end of file diff --git a/markwon/src/test/resources/tests/deeply-nested.yaml b/markwon/src/test/resources/tests/deeply-nested.yaml deleted file mode 100644 index 4ed4da52..00000000 --- a/markwon/src/test/resources/tests/deeply-nested.yaml +++ /dev/null @@ -1,12 +0,0 @@ -input: |- - **bold *bold italic `bold italic code` bold italic* bold** normal - -output: - - b: - - "bold " - - i: - - "bold italic " - - code: "bold italic code" - - " bold italic" - - " bold" - - " normal" \ No newline at end of file diff --git a/markwon/src/test/resources/tests/first.md b/markwon/src/test/resources/tests/first.md new file mode 100644 index 00000000..6f075385 --- /dev/null +++ b/markwon/src/test/resources/tests/first.md @@ -0,0 +1,2 @@ +Here is some [link](https://my.href) +**bold _bold italic_ bold** normal \ No newline at end of file diff --git a/markwon/src/test/resources/tests/first.yaml b/markwon/src/test/resources/tests/first.yaml deleted file mode 100644 index d52d670d..00000000 --- a/markwon/src/test/resources/tests/first.yaml +++ /dev/null @@ -1,23 +0,0 @@ -description: Defining test case format - -input: |- - Here is some [link](https://my.href) - **bold _bold italic_ bold** normal - -config: - use-paragraphs: false - use-html: false - soft-break-adds-new-line: false - html-allow-non-closed-tags: false - -output: - - "Here is some " - - a: "link" - href: "https://my.href" - - " " - - b: - - "bold " - - i: "bold italic" #equals to: `- i: - text: "bold italic"` - - " bold" - - " normal" - diff --git a/settings.gradle b/settings.gradle index d5f56c45..ede0753a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -11,5 +11,6 @@ include ':app', ':markwon-html', ':markwon-view', ':markwon-test-span', + ':markwon-test-util', ':sample-custom-extension', ':sample-latex-math'