diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-01-29 16:26:00 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-01-29 16:26:00 -0800 |
commit | 3b5dbe6fdb3888b263a52e001918b0e97789a38c (patch) | |
tree | facb4bbdaa7f402ad9ebefebdb7587417fa458e1 /src/Tests | |
parent | 22969c1b9cc88225c8bc60ac4e98636051ca7b4c (diff) | |
download | pandoc-3b5dbe6fdb3888b263a52e001918b0e97789a38c.tar.gz |
Added HTML writer tests for inline code.
Diffstat (limited to 'src/Tests')
-rw-r--r-- | src/Tests/Writers/HTML.hs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Tests/Writers/HTML.hs b/src/Tests/Writers/HTML.hs new file mode 100644 index 000000000..e13d0dc87 --- /dev/null +++ b/src/Tests/Writers/HTML.hs @@ -0,0 +1,41 @@ +{-# LANGUAGE OverloadedStrings, QuasiQuotes #-} +module Tests.Writers.HTML (tests) where + +import Test.Framework +import Text.Pandoc.Builder +import Text.Pandoc +import Tests.Helpers +import Tests.Arbitrary() +import Text.Pandoc.Highlighting (languages) -- null if no hl support + +html :: (ToString a, ToPandoc a) => a -> String +html = writeHtmlString defaultWriterOptions{ writerWrapText = False } . toPandoc + +{- + "my test" =: X =?> Y + +is shorthand for + + test html "my test" $ X =?> Y + +which is in turn shorthand for + + test html "my test" (X,Y) +-} + +infix 5 =: +(=:) :: (ToString a, ToPandoc a) + => String -> (a, String) -> Test +(=:) = test html + +tests :: [Test] +tests = [ testGroup "inline code" + [ "basic" =: code "@&" =?> "<code>@&</code>" + , "haskell" =: codeWith ("",["haskell"],[]) ">>=" + =?> if null languages + then "<code class=\"haskell\">>>=</code>" + else "<code class=\"sourceCode haskell\"><span class=\"fu\">>>=</span></code>" + , "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>=" + =?> "<code class=\"nolanguage\">>>=</code>" + ] + ] |