pandoc/tests/Tests/Writers/HTML.hs

44 lines
1.1 KiB
Haskell
Raw Normal View History

2013-01-23 08:47:43 -08:00
{-# LANGUAGE OverloadedStrings #-}
module Tests.Writers.HTML (tests) where
import Test.Framework
import Text.Pandoc.Builder
import Text.Pandoc
import Tests.Helpers
import Text.Pandoc.Arbitrary()
html :: (ToPandoc a) => a -> String
2016-11-27 11:52:42 +01:00
html = purely (writeHtmlString def{ writerWrapText = WrapNone }) . 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 4 =:
(=:) :: (ToString a, ToPandoc a)
=> String -> (a, String) -> Test
(=:) = test html
tests :: [Test]
tests = [ testGroup "inline code"
[ "basic" =: code "@&" =?> "<code>@&amp;</code>"
, "haskell" =: codeWith ("",["haskell"],[]) ">>="
=?> "<code class=\"haskell\">&gt;&gt;=</code>"
, "nolanguage" =: codeWith ("",["nolanguage"],[]) ">>="
=?> "<code class=\"nolanguage\">&gt;&gt;=</code>"
]
, testGroup "images"
[ "alt with formatting" =:
2011-12-13 14:29:07 -08:00
image "/url" "title" ("my " <> emph "image")
=?> "<img src=\"/url\" title=\"title\" alt=\"my image\" />"
]
]