diff --git a/md4k/build.gradle.kts b/md4k/build.gradle.kts index f364ed6..0db5dee 100644 --- a/md4k/build.gradle.kts +++ b/md4k/build.gradle.kts @@ -39,3 +39,8 @@ android { jvmTarget = "1.8" } } + +dependencies { + androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation("androidx.test:runner:1.5.2") +} \ No newline at end of file diff --git a/md4k/src/androidTest/kotlin/com/wbrawner/md4k/MarkdownParserTest.kt b/md4k/src/androidTest/kotlin/com/wbrawner/md4k/MarkdownParserTest.kt new file mode 100644 index 0000000..4d3d7e8 --- /dev/null +++ b/md4k/src/androidTest/kotlin/com/wbrawner/md4k/MarkdownParserTest.kt @@ -0,0 +1,28 @@ +package com.wbrawner.md4k + +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Parameterized +import org.junit.runners.Parameterized.Parameters + +@RunWith(Parameterized::class) +class MarkdownParserTest(private val markdown: String, private val html: String) { + + @Test + fun testMarkdownToHtmlConversion() { + val parsedHtml = markdown.toHtml() + assert(parsedHtml == html) { + """expected "$html", got "$parsedHtml"""" + } + } + + companion object { + @JvmStatic + @Parameters(name = "Markdown: {0}") + fun data(): Array> = arrayOf( + arrayOf("# Test", "

Test

\n"), + arrayOf("- [ ] Check this", "\n"), + arrayOf("- [x] Checked!", "\n"), + ) + } +} \ No newline at end of file