Added more tests
This commit is contained in:
18
src/Test.hs
18
src/Test.hs
@@ -26,19 +26,35 @@ boldTests =
|
||||
check_equal "Should convert bold and italic in a sentence" "<p>It <i>is</i> a <b>wonderful</b> day</p>" (convert "It _is_ a __wonderful__ day")
|
||||
]
|
||||
|
||||
linkTests =
|
||||
TestList
|
||||
[ check_equal "Should convert normal link" "<p><a href=\"https://example.com\">This is an example link.</a></p>" (convert "[This is an example link.](https://example.com)"),
|
||||
check_equal "Should convert styled link" "<p><a href=\"https://example.com\"><b>Fancy</b>!!!</a></p>" (convert "[__Fancy__!!!](https://example.com)")
|
||||
]
|
||||
|
||||
escapedCharTests =
|
||||
TestList
|
||||
[ check_equal "Should print literal underscore" "<p>This is an underscore - _</p>" (convert "This is an underscore - \\_"),
|
||||
check_equal "Should print literal asterisk" "<p>This is an asterisk - *</p>" (convert "This is an asterisk - \\*"),
|
||||
check_equal "Should print literal asterisk in bold" "<p>This is a bolded asterisk - <b>*</b></p>" (convert "This is a bolded asterisk - **\\***")
|
||||
]
|
||||
|
||||
integrationTests =
|
||||
TestList
|
||||
[ check_equal "Integration 1" "<h1>Sample Markdown</h1><p>This is some basic, sample markdown.</p><h2><b>Second</b> <i>Heading</i></h2>" (convert "# Sample Markdown\n\n This is some basic, sample markdown.\n\n ## __Second__ _Heading_"),
|
||||
check_equal "Integration 2" "<p><b>Hello</b> <i>World</i></p>" (convert "__Hello__\n_World_"),
|
||||
check_equal "Integration 3" "<h1>Hello</h1><p>World</p>" (convert "# Hello\nWorld"),
|
||||
check_equal "Integration 4" "<p>a b</p>" (convert "a\nb"),
|
||||
check_equal "Integration 5" "<h1>Hello</h1>" (convert "# Hello\n")
|
||||
check_equal "Integration 5" "<h1>Hello</h1>" (convert "# Hello\n"),
|
||||
check_equal "Integration 6" "<p>First line<br>Second line</p>" (convert "First line \nSecond line")
|
||||
]
|
||||
|
||||
tests =
|
||||
TestList
|
||||
[ headerTests,
|
||||
boldTests,
|
||||
linkTests,
|
||||
escapedCharTests,
|
||||
integrationTests
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user