Added more tests

This commit is contained in:
2025-05-02 10:59:20 -04:00
parent 2273448208
commit e51d16a39b

View File

@@ -3,6 +3,8 @@ module MdToHtmlTest where
import MdToHTML
import Test.HUnit
check_equal expected actual
headerTests = TestList
[
(TestCase (assertEqual "Should convert H1 heading" "<h1>Hello</h1>" (show . fst $ leftmostLongestParse parseLine "# Hello"))),
@@ -13,10 +15,17 @@ headerTests = TestList
(TestCase (assertEqual "Should convert H6 heading" "<h6>Hello</h6>" (show . fst $ leftmostLongestParse parseLine "###### Hello")))
]
boldTests = TestList
[
(TestCase (assertEqual "Should convert bold" "<b>Hello</b>" (show . fst $ leftmostLongestParse parseLine "__Hello__"))),
(TestCase (assertEqual "Should convert italic" "<i>Hello</i>" (show . fst $ leftmostLongestParse parseLine "_Hello_"))),
(TestCase (assertEqual "Should convert bold and italic in a sentence" "It <i>is</i> a <b>wonderful</b> day" (show . fst $ leftmostLongestParse parseLine "It _is_ a __wonderful__ day")))
]
tests = TestList
[
headerTests
headerTests,
boldTests
]
runTests = runTestTT tests