pandoc/test/Tests/Readers/Man.hs

45 lines
1 KiB
Haskell
Raw Normal View History

2018-02-25 01:34:17 +01:00
{-# LANGUAGE OverloadedStrings #-}
module Tests.Readers.Man (tests) where
2018-05-09 19:40:37 +02:00
import Prelude
2018-02-25 01:34:17 +01:00
import Data.Text (Text)
import Test.Tasty
import Tests.Helpers
import Text.Pandoc
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
2018-05-09 02:24:45 +02:00
import Text.Pandoc.Readers.Man
2018-02-25 01:34:17 +01:00
2018-05-09 02:24:45 +02:00
man :: Text -> Pandoc
man = purely $ readMan def
infix 4 =:
(=:) :: ToString c
=> String -> (Text, c) -> TestTree
(=:) = test man
2018-02-25 01:34:17 +01:00
tests :: [TestTree]
2018-05-09 02:24:45 +02:00
tests = [
-- .SH "HEllo bbb" "aaa"" as"
testGroup "Macros" [
"Bold" =:
2018-05-22 23:20:30 +02:00
".B foo"
2018-05-09 19:40:37 +02:00
=?> (para $ strong "foo")
2018-05-09 02:24:45 +02:00
, "Italic" =:
2018-05-22 23:20:30 +02:00
".I bar\n"
=?> (para $ emph "bar")
, "BoldItalic" =:
".BI foo bar"
=?> (para $ strong $ emph $ str "foo bar")
, "H1" =:
".SH The header\n"
=?> header 2 (str "The header")
, "H2" =:
".SS The header 2"
=?> header 3 (str "The header 2")
, "Macro args" =:
".B \"single arg with \"\"Q\"\"\""
=?> (para $ strong $ str "single arg with \"Q\"")
2018-05-09 02:24:45 +02:00
]
]