pandoc/tests/Tests/Readers/LaTeX.hs

45 lines
1.2 KiB
Haskell
Raw Normal View History

{-# LANGUAGE OverloadedStrings #-}
2011-01-12 19:10:56 +01:00
module Tests.Readers.LaTeX (tests) where
import Text.Pandoc.Definition
import Test.Framework
import Tests.Helpers
2011-01-22 22:40:18 +01:00
import Tests.Arbitrary()
import Text.Pandoc.Builder
import Text.Pandoc
latex :: String -> Pandoc
latex = readLaTeX defaultParserState
infix 5 =:
(=:) :: ToString c
=> String -> (String, c) -> Test
(=:) = test latex
tests :: [Test]
2011-01-13 20:11:55 +01:00
tests = [ testGroup "basic"
[ "simple" =:
"word" =?> para "word"
, "space" =:
"some text" =?> para ("some text")
, "emphasized" =:
"\\emph{emphasized}" =?> para (emph "emphasized")
2011-01-13 20:11:55 +01:00
]
, testGroup "headers"
[ "level 1" =:
"\\section{header}" =?> header 1 "header"
, "level 2" =:
"\\subsection{header}" =?> header 2 "header"
, "level 3" =:
"\\subsubsection{header}" =?> header 3 "header"
, "emph" =:
"\\section{text \\emph{emph}}" =?>
header 1 ("text" +++ space +++ emph "emph")
, "link" =:
"\\section{text \\href{/url}{link}}" =?>
header 1 ("text" +++ space +++ link "/url" "" "link")
2011-01-13 20:11:55 +01:00
]
]