82b3e0ab97
- The (non-exported) prelude is in prelude/Prelude.hs. - It exports Monoid and Applicative, like base 4.8 prelude, but works with older base versions. - It exports (<>) for mappend. - It hides 'catch' on older base versions. This allows us to remove many imports of Data.Monoid and Control.Applicative, and remove Text.Pandoc.Compat.Monoid. It should allow us to use -Wall again for ghc 7.10.
55 lines
2.2 KiB
Haskell
55 lines
2.2 KiB
Haskell
module Tests.Writers.AsciiDoc (tests) where
|
|
|
|
import Test.Framework
|
|
import Text.Pandoc.Builder
|
|
import Text.Pandoc
|
|
import Tests.Helpers
|
|
import Tests.Arbitrary()
|
|
|
|
asciidoc :: (ToString a, ToPandoc a) => a -> String
|
|
asciidoc = writeAsciiDoc def{ writerWrapText = False } . toPandoc
|
|
|
|
tests :: [Test]
|
|
tests = [ testGroup "emphasis"
|
|
[ test asciidoc "emph word before" $
|
|
para (text "foo" <> emph (text "bar")) =?>
|
|
"foo__bar__"
|
|
, test asciidoc "emph word after" $
|
|
para (emph (text "foo") <> text "bar") =?>
|
|
"__foo__bar"
|
|
, test asciidoc "emph quoted" $
|
|
para (doubleQuoted (emph (text "foo"))) =?>
|
|
"``__foo__''"
|
|
, test asciidoc "strong word before" $
|
|
para (text "foo" <> strong (text "bar")) =?>
|
|
"foo**bar**"
|
|
, test asciidoc "strong word after" $
|
|
para (strong (text "foo") <> text "bar") =?>
|
|
"**foo**bar"
|
|
, test asciidoc "strong quoted" $
|
|
para (singleQuoted (strong (text "foo"))) =?>
|
|
"`**foo**'"
|
|
]
|
|
, testGroup "tables"
|
|
[ test asciidoc "empty cells" $
|
|
simpleTable [] [[mempty],[mempty]] =?> unlines
|
|
[ "[cols=\"\",]"
|
|
, "|===="
|
|
, "|"
|
|
, "|"
|
|
, "|===="
|
|
]
|
|
, test asciidoc "multiblock cells" $
|
|
simpleTable [] [[para (text "Para 1") <> para (text "Para 2")]]
|
|
=?> unlines
|
|
[ "[cols=\"\",]"
|
|
, "|====="
|
|
, "a|"
|
|
, "Para 1"
|
|
, ""
|
|
, "Para 2"
|
|
, ""
|
|
, "|====="
|
|
]
|
|
]
|
|
]
|