From a242ebaf29539d6a9a4eec97e510b5f8e4b59b30 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 23 Aug 2011 00:00:32 +0200 Subject: Imported Upstream version 1.8.2 --- src/Tests/Readers/Markdown.hs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/Tests/Readers/Markdown.hs') diff --git a/src/Tests/Readers/Markdown.hs b/src/Tests/Readers/Markdown.hs index feec8fa65..941762bd0 100644 --- a/src/Tests/Readers/Markdown.hs +++ b/src/Tests/Readers/Markdown.hs @@ -8,10 +8,14 @@ import Tests.Arbitrary() import Text.Pandoc.Builder -- import Text.Pandoc.Shared ( normalize ) import Text.Pandoc +import Data.Sequence (singleton) markdown :: String -> Pandoc markdown = readMarkdown defaultParserState{ stateStandalone = True } +markdownSmart :: String -> Pandoc +markdownSmart = readMarkdown defaultParserState{ stateSmart = True } + infix 5 =: (=:) :: ToString c => String -> (String, c) -> Test @@ -40,6 +44,22 @@ tests = [ testGroup "inline code" "`*` {.haskell .special x=\"7\"}" =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*") ] + , testGroup "smart punctuation" + [ test markdownSmart "quote before ellipses" + ("'...hi'" + =?> para (singleQuoted (singleton Ellipses +++ "hi"))) + ] + , testGroup "mixed emphasis and strong" + [ "emph and strong emph alternating" =: + "*xxx* ***xxx*** xxx\n*xxx* ***xxx*** xxx" + =?> para (emph "xxx" +++ space +++ strong (emph "xxx") +++ + space +++ "xxx" +++ space +++ + emph "xxx" +++ space +++ strong (emph "xxx") +++ + space +++ "xxx") + , "emph with spaced strong" =: + "*x **xx** x*" + =?> para (emph ("x" +++ space +++ strong "xx" +++ space +++ "x")) + ] , testGroup "footnotes" [ "indent followed by newline and flush-left text" =: "[^1]\n\n[^1]: my note\n\n \nnot in note\n" @@ -47,6 +67,19 @@ tests = [ testGroup "inline code" , "indent followed by newline and indented text" =: "[^1]\n\n[^1]: my note\n \n in note\n" =?> para (note (para "my note" +++ para "in note")) + , "recursive note" =: + "[^1]\n\n[^1]: See [^1]\n" + =?> para (note (para "See [^1]")) + ] + , testGroup "lhs" + [ test (readMarkdown defaultParserState{stateLiterateHaskell = True}) + "inverse bird tracks and html" $ + "> a\n\n< b\n\n
\n" + =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a" + +++ + codeBlockWith ("",["sourceCode","haskell"],[]) "b" + +++ + rawBlock "html" "
\n\n" ] -- the round-trip properties frequently fail -- , testGroup "round trip" -- cgit v1.2.3