diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-07-26 08:37:36 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-07-26 08:37:36 -0700 |
commit | 45e4c123a45b83d666088967c25b91cf9bb5db72 (patch) | |
tree | b3662354ccacd88b0d9238b3d0c049c4c876abc4 /src/Tests/Readers/Markdown.hs | |
parent | 3053267280bfd7b255f3bf47480e4a8a97ec2915 (diff) | |
download | pandoc-45e4c123a45b83d666088967c25b91cf9bb5db72.tar.gz |
Moved tests to tests/, modified cabal file so lib isn't recompiled.
Diffstat (limited to 'src/Tests/Readers/Markdown.hs')
-rw-r--r-- | src/Tests/Readers/Markdown.hs | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/src/Tests/Readers/Markdown.hs b/src/Tests/Readers/Markdown.hs deleted file mode 100644 index 543802795..000000000 --- a/src/Tests/Readers/Markdown.hs +++ /dev/null @@ -1,107 +0,0 @@ -{-# LANGUAGE OverloadedStrings, QuasiQuotes #-} -module Tests.Readers.Markdown (tests) where - -import Text.Pandoc.Definition -import Test.Framework -import Tests.Helpers -import Tests.Arbitrary() -import Text.Pandoc.Builder --- import Text.Pandoc.Shared ( normalize ) -import Text.Pandoc - -markdown :: String -> Pandoc -markdown = readMarkdown def - -markdownSmart :: String -> Pandoc -markdownSmart = readMarkdown def { readerSmart = True } - -infix 4 =: -(=:) :: ToString c - => String -> (String, c) -> Test -(=:) = test markdown - -{- -p_markdown_round_trip :: Block -> Bool -p_markdown_round_trip b = matches d' d'' - where d' = normalize $ Pandoc (Meta [] [] []) [b] - d'' = normalize - $ readMarkdown def { readerSmart = True } - $ writeMarkdown defaultWriterOptions d' - matches (Pandoc _ [Plain []]) (Pandoc _ []) = True - matches (Pandoc _ [Para []]) (Pandoc _ []) = True - matches (Pandoc _ [Plain xs]) (Pandoc _ [Para xs']) = xs == xs' - matches x y = x == y --} - -tests :: [Test] -tests = [ testGroup "inline code" - [ "with attribute" =: - "`document.write(\"Hello\");`{.javascript}" - =?> para - (codeWith ("",["javascript"],[]) "document.write(\"Hello\");") - , "with attribute space" =: - "`*` {.haskell .special x=\"7\"}" - =?> para (codeWith ("",["haskell","special"],[("x","7")]) "*") - ] - , testGroup "backslash escapes" - [ "in URL" =: - "[hi](/there\\))" - =?> para (link "/there)" "" "hi") - , "in title" =: - "[hi](/there \"a\\\"a\")" - =?> para (link "/there" "a\"a" "hi") - , "in reference link title" =: - "[hi]\n\n[hi]: /there (a\\)a)" - =?> para (link "/there" "a)a" "hi") - , "in reference link URL" =: - "[hi]\n\n[hi]: /there\\.0" - =?> para (link "/there.0" "" "hi") - ] - , testGroup "smart punctuation" - [ test markdownSmart "quote before ellipses" - ("'...hi'" - =?> para (singleQuoted ("…hi"))) - , test markdownSmart "apostrophe before emph" - ("D'oh! A l'*aide*!" - =?> para ("D’oh! A l’" <> emph "aide" <> "!")) - , test markdownSmart "apostrophe in French" - ("À l'arrivée de la guerre, le thème de l'«impossibilité du socialisme»" - =?> para ("À l’arrivée de la guerre, le thème de l’«impossibilité du socialisme»")) - ] - , 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" - =?> para (note (para "my note")) <> para "not in note" - , "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 def{ readerLiterateHaskell = True }) - "inverse bird tracks and html" $ - "> a\n\n< b\n\n<div>\n" - =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a" - <> - codeBlockWith ("",["sourceCode","haskell"],[]) "b" - <> - rawBlock "html" "<div>\n\n" - ] --- the round-trip properties frequently fail --- , testGroup "round trip" --- [ property "p_markdown_round_trip" p_markdown_round_trip --- ] - ] |