pandoc/test/Tests/Writers/TEI.hs

46 lines
1.3 KiB
Haskell
Raw Normal View History

{-# LANGUAGE NoImplicitPrelude #-}
2015-12-24 11:36:58 -05:00
{-# LANGUAGE OverloadedStrings #-}
module Tests.Writers.TEI (tests) where
import Prelude
import Test.Tasty
2015-12-24 11:36:58 -05:00
import Tests.Helpers
import Text.Pandoc
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
2015-12-24 11:36:58 -05:00
{-
"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) -> TestTree
2016-11-27 11:52:42 +01:00
(=:) = test (purely (writeTEI def) . toPandoc)
2015-12-24 11:36:58 -05:00
tests :: [TestTree]
2015-12-24 11:36:58 -05:00
tests = [ testGroup "block elements"
["para" =: para "Lorem ipsum cetera."
=?> "<p>Lorem ipsum cetera.</p>"
2015-12-24 11:36:58 -05:00
]
, testGroup "inlines"
[
2018-01-19 21:25:24 -08:00
"Emphasis" =: emph "emphasized"
=?> "<p><hi rendition=\"simple:italic\">emphasized</hi></p>"
,"SingleQuoted" =: singleQuoted (text "quoted material")
=?> "<p><quote>quoted material</quote></p>"
,"DoubleQuoted" =: doubleQuoted (text "quoted material")
=?> "<p><quote>quoted material</quote></p>"
,"NestedQuoted" =: doubleQuoted (singleQuoted (text "quoted material"))
=?> "<p><quote><quote>quoted material</quote></quote></p>"
]
]